Professional Documents
Culture Documents
TheLinuxfilesystemhasatreelikestructure.
Thetreelikestructureisalsoreferredtoas
theDirectorytree
WhenwedrawtheLinuxfilesystemonapaper,
weseeatreelikestructuredeveloping.That's
whyitiscalledthedirectorytree.
Afolderisalocationthatstoresmultiplefiles
Windowsusersusuallyusethewordfolderinstead
ofadirectory,however,inLinuxterminologywe
alwayssayadirectoryinsteadofafolder.
TheDirectoryTree
Here are some facts about the directory tree
Eachdirectory(orfile)hasexactlyoneparent
Thefirstdirectory(topmost)inourdirectory
treeiscalledtherootdirectory.Itis
representedbyaforwardslash/
Therootdirectorycontainsfilesand
subdirectories,whichcontainmorefilesand
subdirectoriesandsoon.
Visualizingthefilesystem
/
bin
ls
opt
pwd
chrome
home
earth
music
john
tmp
david
documents
phone.txt
temporary files
var
log files
CommonDirectories
/
/etc
/bin
Therootdirectory,Whereeverythingbegins
Thisdirectorycontainssystemconfigurationfiles
Thisdirectorycontainsthecommandsandutilitiesthat
youonadailybasis(Alltheusershaveaccesstoit)
/sbin
Thisdirectorycontainsprogramsthatperforms
vitalsystemtasks(Networkmanagement,Disk
partitioning).Onlythesuperuserhasaccesstothese
programs.
/home
Eachuserisgivenadirectoryunderthehome
directory.Ausercanstoreanythinginhishome
directory
Ex:Musicfiles,Pictures,...etc
/opt
Thisdirectorycontainsoptionalcommercialsoftware
productsthatarenotinstalledbydefaultonthe
system(Ex:GoogleEarth)
/tmp
Thisdirectorycontainstemporaryfilescreatedby
variousprograms.Generallyclearedonreboot
/var
Containsvariabledata(Ex:databases,spoolfiles,user
mail,etc.arelocatedhere.)
TwospecialDirectories
Undereachdirectory,wehavetwospecial
directories
(1)Thecurrentdirectoryrepresentedas.
(2)Theparentdirectoryrepresentedas..
andsoonedotreferstothecurrentdirectory
andtwodotsreferstotheparent(Previous)
directory.
Absoluteandrelativepaths
Anabsolutepathbeginswiththerootdirectory
andfollowsthedirectorytreebranchbybranch
untilthepathtothedesireddirectoryorfileis
completed.
Example
/home/john/documents/phone.txt
istheabsolutepathofthefilephone.txt
Noticeweusea/toseparatebetweendirectories.
Arelativepathstartsfromthecurrentworking
directory.
Example
ifourcurrentworkingdirectoryisjohn
then./documents/phone.txtisrelativepathof
thefilephone.txt
Youcanomitthe./andsodocuments/phone.txt
alsoworks