Linux编程:Linux目次布局(Linux文件体系布局)仓酷云
Linux的常用命令find,察看man文档,初学者一定会觉得太复杂而不原意用,但是你一旦学会就爱不释手。Haveyouwonderedwhycertainprogramsarelocatedunder/bin,or/sbin,or/usr/bin,or/usr/sbin?
Forexample,lesscommandislocatedunder/usr/bindirectory.Whynot/bin,or/sbin,or/usr/sbin?Whatisthedifferentbetweenallthesedirectories?
Inthisarticle,letusreviewtheLinuxfilesystemstructuresandunderstandthemeaningofindividualhigh-leveldirectories.
<br>
1./–Root
[*]Everysinglefileanddirectorystartsfromtherootdirectory.
[*]Onlyrootuserhaswriteprivilegeunderthisdirectory.
[*]Pleasenotethat/rootisrootuser’shomedirectory,whichisnotsameas/.
2./bin–UserBinaries
[*]Containsbinaryexecutables.
[*]Commonlinuxcommandsyouneedtouseinsingle-usermodesarelocatedunderthisdirectory.
[*]Commandsusedbyalltheusersofthesystemarelocatedhere.
[*]Forexample:ps,ls,ping,grep,cp.
3./sbin–SystemBinaries
[*]Justlike/bin,/sbinalsocontainsbinaryexecutables.
[*]But,thelinuxcommandslocatedunderthisdirectoryareusedtypicallybysystemaministrator,forsystemmaintenancepurpose.
[*]Forexample:iptables,reboot,fdisk,ifconfig,swapon
4./etc–ConfigurationFiles
[*]Containsconfigurationfilesrequiredbyallprograms.
[*]Thisalsocontainsstartupandshutdownshellscriptsusedtostart/stopindividualprograms.
[*]Forexample:/etc/resolv.conf,/etc/logrotate.conf
5./dev–DeviceFiles
[*]Containsdevicefiles.
[*]Theseincludeterminaldevices,usb,oranydeviceattachedtothesystem.
[*]Forexample:/dev/tty1,/dev/usbmon0
6./proc–ProcessInformation
[*]Containsinformationaboutsystemprocess.
[*]Thisisapseudofilesystemcontainsinformationaboutrunningprocess.Forexample:/proc/{pid}directorycontainsinformationabouttheprocesswiththatparticularpid.
[*]Thisisavirtualfilesystemwithtextinformationaboutsystemresources.Forexample:/proc/uptime
7./var–VariableFiles
[*]varstandsforvariablefiles.
[*]Contentofthefilesthatareexpectedtogrowcanbefoundunderthisdirectory.
[*]Thisincludes—systemlogfiles(/var/log);packagesanddatabasefiles(/var/lib);emails(/var/mail);printqueues(/var/spool);lockfiles(/var/lock);tempfilesneededacrossreboots(/var/tmp);
8./tmp–TemporaryFiles
[*]Directorythatcontainstemporaryfilescreatedbysystemandusers.
[*]Filesunderthisdirectoryaredeletedwhensystemisrebooted.
9./usr–UserPrograms
[*]Containsbinaries,libraries,documentation,andsource-codeforsecondlevelprograms.
[*]/usr/bincontainsbinaryfilesforuserprograms.Ifyoucan’tfindauserbinaryunder/bin,lookunder/usr/bin.Forexample:at,awk,cc,less,scp
[*]/usr/sbincontainsbinaryfilesforsystemadministrators.Ifyoucan’tfindasystembinaryunder/sbin,lookunder/usr/sbin.Forexample:atd,cron,sshd,useradd,userdel
[*]/usr/libcontainslibrariesfor/usr/binand/usr/sbin
[*]/usr/localcontainsusersprogramsthatyouinstallfromsource.Forexample,whenyouinstallapachefromsource,itgoesunder/usr/local/apache2
10./home–HomeDirectories
[*]Homedirectoriesforalluserstostoretheirpersonalfiles.
[*]Forexample:/home/john,/home/nikita
11./boot–BootLoaderFiles
[*]Containsbootloaderrelatedfiles.
[*]Kernelinitrd,vmlinux,grubfilesarelocatedunder/boot
[*]Forexample:initrd.img-2.6.32-24-generic,vmlinuz-2.6.32-24-generic
12./lib–SystemLibraries
[*]Containslibraryfilesthatsupportsthebinarieslocatedunder/binand/sbin
[*]Libraryfilenamesareeitherld*orlib*.so.*
[*]Forexample:ld-2.11.1.so,libncurses.so.5.7
13./opt–Optionaladd-onApplications
[*]optstandsforoptional.
[*]Containsadd-onapplicationsfromindividualvendors.
[*]add-onapplicationsshouldbeinstalledundereither/opt/or/opt/sub-directory.
14./mnt–MountDirectory
[*]Temporarymountdirectorywheresysadminscanmountfilesystems.
15./media–RemovableMediaDevices
[*]Temporarymountdirectoryforremovabledevices.
[*]Forexamples,/media/cdromforCD-ROM;/media/floppyforfloppydrives;/media/cdrecorderforCDwriter
16./srv–ServiceData
[*]srvstandsforservice.
[*]Containsserverspecificservicesrelateddata.
[*]Forexample,/srv/cvscontainsCVSrelateddata.
按照它们在系统中的作用分成几个部分介绍给大家,通过这些基础命令的学习我们可以进一步理解Linux系统: Linux?最大的优点在于其作为服务器的强大功能,同时支持多种应用程序及开发工具,所以Linux操作系统有着广泛的应用空间。 要增加自己Linux的技能,只有通过实践来实现了。所以,赶快找一部计算机,赶快安装一个Linux发行版本,然后进入精彩的Linux世界,相信对于你自己的Linux能力必然大有斩获。 如果上面的措施没有解决问题,此时你就需要Linux社区的帮助了。 Linux的使用者一般都是专业人士,他们有着很好的电脑背景且愿意协助他人。 随着实验课程的结束,理论课也该结束了,说实话教OS的这两位老师是我们遇到过的不错的老师(这话放这可能不太恰当). 学习Linux应具备的。[书籍+网络资源] 我是学习嵌入式方向的,这学期就选修了这门专业任选课。 熟读写基础知识,学得会不如学得牢。 掌握硬件配置,如显卡,声卡,网卡等,硬件只要不是太老或太新一般都能被支持,作为一名Linux系统管理员建议多阅读有关硬件配置文章,对各种不支持或支持不太好的硬件有深刻的了解。
页:
[1]