Every Linux server uses approximately the same root folder hierarchy, but many users don’t know what all of the folders are for. These are the folders that contain everything on the server, and everything required by the operating system, so it is a bit more complicated than “Pictures”, “Desktop”, etc.!
All of the basic Linux directories in the hierarchy have an important purpose, but the nice thing is that for most uses, nothing needs to be added to the root hierarchy. Users can use the existing folders to add their own files, scripts, and software.
Below is a list of the most common Linux root directories, and an explanation of the purpose of each directory:
Common Linux Root Directories
/bin : All the executable binary programs required during boot-up, repair, files required to run into single-user-mode, and other important, basic commands like cat, du, df, tar, rpm, wc, history, etc.
/boot : Holds important files during boot-up process, including the system kernel.
/dev : Contains device files for all the hardware devices on the machine, for example storage volumes.
/etc : Contains configuration files and startup/status/shutdown scripts for applications.
/home : The system users’ home directory for user files. Each new user added to the system will correspond to a new folder in /home.
/lib : The Lib directory contains kernel modules and shared library images required to boot the system and run commands in the root file system.
/lost+found : This directory collects files that may be damaged, or need repair, during a crash or improper shutdown.
/mnt : Temporary mount directory for mounting file systems.
/opt : Optional is abbreviated as opt. Contains third-party software, code for compiling software, and user-installed software.
/proc : A virtual and pseudo file-system which contains information about running process with a particular Process ID (pid).
/root : This is the home directory of root user, and should never be confused with ‘/‘. It is used for the root user’s ‘personal’ files.
/sbin : Contains binary executable programs required by System Administrator for maintenance, like iptables, fdisk, ifconfig, swapon, reboot.
/sys : Modern Linux distributions include a /sys directory as a virtual filesystem, which stores and allows modification of the devices connected to the system.
/tmp : The system’s temporary directory, accessible by users and root. Stores temporary files for user and system until the next reboot.
/usr : Contains executable binaries, documentation, source code, and libraries for second-level programs.
/var : Stands for variable. The contents of this folder are expected to grow. This directory contains logs, lock, spool, mail, and temp files.