Linux has no drive letters. Everything hangs from one tree that starts at /, called the root directory. Extra disks, USB sticks and network shares appear as directories somewhere inside that tree.
The layout is described by the Filesystem Hierarchy Standard (FHS). Distributions follow it closely, though not perfectly.
The top level
$ ls /
bin dev home lib64 mnt proc run srv tmp var
boot etc lib media opt root sbin sys usr/etcholds system-wide configuration, mostly plain text files./homeholds the personal directories of regular users./rootis the home directory of the root user. It is not the same thing as/./bootholds the kernel and boot loader files.
Programs and libraries
/usr holds most installed software: commands in /usr/bin, libraries in /usr/lib, shared data in /usr/share. /usr/local is for software the administrator installs by hand, so the package manager leaves it alone. /opt is for self-contained add-on packages.
Many current distributions have merged /bin, /sbin and /lib into /usr. The old names remain as symbolic links:
$ ls -ld /bin
lrwxrwxrwx 1 root root 7 Jan 5 10:12 /bin -> usr/binOlder or differently designed systems may still have real directories there.
Data that changes
/varholds data that grows and changes while the system runs: logs in/var/log, caches, mail and print queues./tmpis for temporary files. Anyone can write there, and it may be emptied at reboot. Do not keep anything important in it./runholds runtime data such as process ID files. It is cleared at every boot.
Virtual and attachment points
/proc and /sys are not stored on disk. The kernel generates their contents on demand to describe processes, devices and settings.
$ cat /proc/uptime
5231.44 19872.10/dev contains device files, such as /dev/sda for a disk. /mnt is for filesystems you mount temporarily by hand. /media is where removable media usually appears. /srv holds data served by this machine, such as web or FTP content.
Finding your way
man hier describes the layout on your own system. To see where a command lives, use command -v:
$ command -v ls
/usr/bin/lsOn a system without the merge, you might see /bin/ls instead.
Try it
Run ls -l / and note which entries are links. Then look inside /etc and /var/log, and read man hier. You can practise on a real shell in the packages, disk and FHS lab.
Check your understanding
The Filesystem Hierarchy
All 5 sections ยท no timer
Unlimited retries
Questions from every section are combined into one assessment. Answer them all correctly to complete the article.
Your completion saves in this browser. Sign in to sync it to your account.