Knowledgebase: Operating Systems > Linux
Linux Directories Explained
Posted by Christopher P. on March 15, 2021 07:49 PM

Most Linux distributions use a file system structure defined by the Filesystem Hierarchy Standard (FHS) 3 specification. Directories can be navigated through using the cd command.

  • Directories can be navigated through using the cd command.
    • For example, cd / would put you into the root of the file system.
  • Note that all binary paths are mapped together in the $PATH variable.
  • You can find the location of any binary by executing which bin where bin is the name of the binary.
    • For example, typically which cat would return /usr/bin/cat.

/ - Filesystem root.

/bin - Contains binaries (executables) essential to the entire operating system. These are available before the /usr partition is mounted. All binaries can be run from the command-line at anytime. Some examples include gzip , cat, and ls.

/sbin - Similar to the /bin directory, this directory contains binaries that are only be used by root or a superuser. Some examples include mount (mount a device or filesystem) and deluser (delete a user account).

/lib - Libraries shared by all binaries from the previous two mentioned directories.

/usr - This directory contains non-system binaries and libraries for normal users. Some examples include:

/usr/bin - Binaries for all users (a.k.a. system-wide binaries).

/usr/lib - Libraries shared by all user binaries.

/usr/local - Contains binaries manually compiled by users.

/etc - The editable text configuration directory, often called et-cetera, which contains text-based configuration files that can be edited in any text editor.

/home - Directory for holding user account data and files. Each user has their own sub-directory. For example, a user named john would have a home directory of /home/john. The ~ is a shortcut to the home directory of a particular user, so if you are logged-in, you can use cd ~ to navigate directly to your home directory.

/boot - Contains files needed to boot the system, such as the Linux kernel.

/dev - Directory containing files to interface with drivers, devices, or partitions. Note that devices are represented as "files" in Linux.

/opt - Contains optional add-on software, which is rarely interacted with.

/var - Contains variable files that will change as the operating system is being used, such as logs and cache files.

/tmp - Contains temporary files that will not be persisted across reboots.

/proc - This directory doesn't exist on the disk, but is created in memory on the fly to keep track of running processes.

(0 vote(s))
Helpful
Not helpful