|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有帐号?立即注册
x
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系统: |
|