The file system structure is the most basic level of organization in an operating system. The way an operating system interacts with its users, applications, and security model nearly always depends on how the operating system organizes files on storage devices. Providing a common file system structure ensures users and programs can access and write files.

File systems are seperated into two logical categories:

  1. Shareable vs. unsharable files
  2. Variable vs. static files
  • Shareable files can be accessed locally and by remote hosts
  • Unsharable files are only available locally. 
  • Variable files, such as documents, can be changed at any time.
  • Static files, such as binaries, do not change without an action from the system administrator.

Purpose of each Directory in the Hierarchy:

/ : Every single file and directory starts from the root directory.

/root : This is the home directory of root user and should never be confused with ‘/‘

/home : Home directory of the users. Directory is created with the name of user and within home directory which contains other directories like Desktop, Downloads, Documents, etc.

/boot : Contains important files during boot-up process, including grub & Kernel.

/etc : Contains Application’s configuration files for every individual program. Eg. /etc/resolv.conf, /etc/http/httpd.conf

/bin : All the executable binary programs (files) required during booting, repairing, files required to run into single-user-mode, and other important, basic eg. cat, du, df, rpm, yum, wstat, wc, etc.

/dev : Contains device files for all the hardware devices on the machine e.g. hdd, cdrom,  etc.

/lib : The Lib directory contains kernel modules and shared library images required to boot the system and run commands in root file system.

/media : Temporary mount directory is created for removable devices eg. /media/cdrom.

/mnt : Temporary mount directory for mounting any file system.

/opt : Optional contains third party application software. eg. Java, etc.

/proc : A virtual and pseudo file-system which contains information about running process. eg. Cpuinfo,uptime. etc.

/run : This directory is the only clean solution for early-runtime-dir problem.

/sbin : Contains binary executable programs are required by privileged users, for Maintenance. eg. fdisk, mkswap, lv commands, ping, etc.

/srv : Service is abbreviated as ‘srv‘. This directory contains server specific and service related files.

/sys : This sys directory acts as a virtual filesystem, which stores and allows modification of the devices connected to the system.

/tmp : System’s temporary directory and stores temporary files for user and system, till next boot.

/usr : Contains executable binaries, documentation, source code, libraries for second level program.

/var : The contents of this file is expected to grow. This directory contains log, lock, spool, mail and temp files.