Linux File System

Linux File System
Linux File System

In Linux and many other operating systems, directories can be structured in a tree-like hierarchy. The Linux directory structure is well defined and documented in the Linux Filesystem Hierarchy Standard (FHS). Referencing those directories when accessing them is accomplished by using the sequentially deeper directory names connected by forward slashes (/) such as /var/log and /var/spool/mail. These are called paths.

The following table provides a very brief list of the standard, well-known, and defined top-level Linux directories and their purposes.

DirectoryDescription
/ (root filesystem)The root filesystem is the top-level directory of the filesystem. It must contain all of the files required to boot the Linux system before other filesystems are mounted. It must include all of the required executables and libraries required to boot the remaining filesystems. After the system is booted, all other filesystems are mounted on standard, well-defined mount points as subdirectories of the root filesystem.
/binThe /bin directory contains user executable files.
/bootContains the static bootloader and kernel executable and configuration files required to boot a Linux computer.
/devThis directory contains the device files for every hardware device attached to the system. These are not device drivers, rather they are files that represent each device on the computer and facilitate access to those devices.
/etcContains the local system configuration files for the host computer.
/homeHome directory storage for user files. Each user has a subdirectory in /home.
/libContains shared library files that are required to boot the system.
/mediaA place to mount external removable media devices such as USB thumb drives that may be connected to the host.
/mntA temporary mountpoint for regular filesystems (as in not removable media) that can be used while the administrator is repairing or working on a filesystem.
/optOptional files such as vendor supplied application programs should be located here.
/rootThis is not the root (/) filesystem. It is the home directory for the root user.
/sbinSystem binary files. These are executables used for system administration.
/tmpTemporary directory. Used by the operating system and many programs to store temporary files. Users may also store files here temporarily. Note that files stored here may be deleted at any time without prior notice.
/usrThese are shareable, read-only files, including executable binaries and libraries, man files, and other types of documentation.
/varVariable data files are stored here. This can include things like log files, MySQL, and other database files, web server data files, email inboxes, and much more.