Linux File System Hierarchy

Linux File System Hierarchy is a reference that describes how the Linux Files System Hierarchy should look like. Currently, the FHS in use is at version 2.3 and was released in 2004. You can check it at http://www.pathname.com/fhs/. Most Linux distros have a policy of respecting FHS, so most users expect the same hierarchy regardless of the Linux flavor they use, but since this is not a standard, anybody can do anything.

The basic hierarchy can be summarized in the following table:

Path Description
/ The Root of the filesystem tree. All files and folders should be accessible under /
/bin Short for Binaries. It holds all basic binaries (executables) that should be accessible by all users (cp, ls, mv, cat…). There shouldn’t be any folders under /bin.
/boot Any files needed in the boot process. These files may be used before the kernel is loaded.
/dev Contains files that are used to access connected devices, like disks (/dev/sdXY, /dev/hdXY, /dev/cdrom …), printers (/dev/printer), mouse(/dev/mouse), but also virtual devices (/dev/null, /dev/random)
/etc Contains configuration files for applications and daemons. Changes to the /etc files only take effect when the affected application/daemon is restarted.
/home Users homes containing files specific to each users
/lib Libraries used by binaries in /bin or /sbin
/media Usually, the place where removable media is mounted (external disks, cdroms, flash media…). Filesystems mounted at boot are usually placed in /media
/mnt The place where temporary removable media is mounted (external disks, cdroms, flash media…)
/opt The place where software packages are installed (like an office application).
/proc It is a virtual filesystem for accessing processor data
/root Home folder of the root user
/sbin Holds essential System Binaries that are used mostly by administrators (init, mount, ifconfig, …)
/srv It should be the place where system-wide data regarding certain servers (www) should be placed, but it is not always used.
/tmp Used for temporary files. Usually it is not preserved between reboots
/usr It should contain read-only user data. This means mostly binaries and libraries that can be run by users, but are not as important as those in /bin or /sbin for system operation
/usr/bin Binaries (executables) that may be run by users
/usr/sbin  Non-esential System Binaries (executables). Usually daemons like crond, httpd, sshd
/usr/lib Libraries for binaries in /usr/bin and /usr/sbin
/var Contains variable data. This may be anything like logs, cache files, mailboxes, even www root.
/var/log Contains logs generated by different applications
/var/opt var folder for binaries in /opt
/var/run Contains data important to the running applications
/var/tmp Temporary files that will be preserved between reboots

Leave a Reply

Your email address will not be published. Required fields are marked *