Linux File System Directory Architecture

In Linux, the directories can be divided into two classifications:

  • Root Directory → It is denoted by ” / ” (forward slash). Root directory is the root/base of the entire file system and cannot be renamed or deleted. There can be only one root directory.
  • Sub Directories → Directories that are under the root ( / ) directory are called sub-directories.

FileSystem Hierarchy Standard (FHS)

The FileSystem Hierarchy Standard (FHS) defines the directory structure and directory contents in a Linux distribution. It also defines the names, permissions and locations for several file types and directories. All files and directories appear under one common root directory, even if they are stored on different devices physically. The root is the parent directory to all other directories. The Linux file system contains the following directories:

  • / (root)
    • Primary hierarchy root and is the first directory and the root directory of the entire file system hierarchy.
    • It contains all other directories i.e. the sub directories.
    • Only the root user has the permissions to write here.
    • This is not the home directory for the root user.
  • /bin (user binaries)
    • It contains binary executables.
    • Binary executables of common linux commands used by all users  in single-user mode are located in this directory.
    • Some files present in this directory are: ls, cp, grep, ping, cat, etc.
  • /boot (boot loader files)
    • It contains boot loader files.
    • kernel, initrdgrub, and other files and directories are located in this directory.
    • e.g. vmlinux-, initrd.img-, etc.
  • /dev (device files)
    • It contains the essential files related to the devices attached to the system.
    • This includes terminal devices, USB, network devices and any other devices that are attached to the system.
    • e.g. /dev/usbmon0 , /dev/tty1 , /dev/null , etc.
  • /etc (configuration files)
    • etc stands for ‘edit to config’
    • This directory contains the configuration files that are required by the installed programs.
    • The files are host-specific and system-wide configurations needed for the proper functioning of the system.
    • This directory also contains shell scripts for system startup and system shutdown that are used to start or stop individual programs.
    • The files in this directory should not be edited without proper knowledge of system configuration as improper configuration could brick the system.
    • e.g. /etc/passwd , /etc/shadow , /etc/group , /etc/resolv.conf , etc.

/etc/opt → configuration files for add-on packages that are stored in /opt

/etc/sgml → configuration files, such as catalogs, for software that processes SGML.

/etc/X11 → configuration files for the X Window System, version 11

/etc/xml → configuration files, such as catalogs, for software that processes XML

  • /home (home directories)
    • This directory contains user’s home directories, containing saved files and personal settings.
    • Each user will have an separate directory with their username under this directory except the root user because every time a new user is created, a directory is created in the name of the user within the home directory.
    • e.g. /home/user , /home/sage , /home/guest , etc.
  • /lib (system libraries)
    • This directory contains libraries that are essential for the binaries in /bin and /sbin
    • Library filenames are either ld*  or  lib*.so.*
    • e.g. , etc.
  • /media (removable media devices)
    • Temporary mount directory for removable media such as CD-ROM.
    • e.g. /media/cdrom for CD-ROM ; /media/floppy for floppy drives ; /media/cdrecorder for CD writer ; etc.
  • /mnt (mount directory)
    • Temporary mount directory where system administrator can mount file systems.
  • /opt (optional application software packages)
    • This directory contains add-on applications from individual vendors.
  • /proc (process information)
    • This is a virtual filesystem providing process and kernel information. This files in this directory are automatically generated, populated and deleted by the system. In Linux, corresponds to a procfs mount.
    • This directory contains information about the processes running in the system.
    • This directory also contains text information about running processes.           e.g. /proc/uptime
    • e.g. /proc/{pid} directory contains information about the process with that particular pid that will be mentioned within the brackets.
  • /root (root directory)
    • This is the home directory for the root user.
  • /sbin (system binaries)
    • This directory contains essential system binaries.
    • The linux commands that are located in this directory are used by system administrator, for system maintenance and configuration purpose.
    • e.g. fsck , reboot , fdisk , ifconfig , init , etc.
  • /srv (service data)
    • This directory contains site-specific data served by the system, such as data and scripts for web servers, data offered by FTP servers, and repositories for version control systems i.e. server specific services related data.
    • e.g. /srv/cvs contains CVS related data , etc.
  • /sys (system)
    • This directory contains information about devices, drivers, and some kernel features.
  • /tmp (temporary files)
    • This directory contains temporary files created by system and the users that will be rebooted when the system is rebooted.
  • /usr (user programs)
    • This directory contains read-only user data like binaries, libraries, documentation and source-code for second level programs like user utilities and applications.

/usr/bin → contains binary files for user programs. If you can’t find a user binary under /bin, then we should look under /usr/bin.

/usr/include → contains standard include files.

/usr/lib → contains libraries for the binaries in /usr/bin and /usr/sbin

/usr/local → tertiary hierarchy for local data. contains users programs that you install from source. e.g., when you install apache, it goes under /usr/local/apache2

/usr/sbin → /usr/sbin contains binary files for system administrators. If you can’t find a system binary under /sbin, then you should look under /usr/sbin. It also contains non-essential system binaries. e.g. daemons for network-services.

/usr/share → contains architecture-independent (shared) data.

/usr/src → contains source code like linux kernel sources, header-files and documentation.

/usr/X11 → contains files related to X Window System.

  • /var (variable files)
    • This directory contains files whose content is expected to continually change during normal operation of the system—such as logs, spool files, and temporary e-mail file.

/var/cache → contains application cache data

/var/lib → contains state information i.e. the data that are modified during the execution of any program.

/var/lock → contains lock files i.e. the files keeping track of resources currently in use.

/var/log → contains system log files.

/var/mail → contains mailbox files.

/var/opt → contains variable data from add-on packages that are stored in /opt.

/var/run → contains run time variable data i.e. it contains system information data describing the system since it was booted.

/var/spool →contains spool for tasks waiting to be processed, e.g., print queues and outgoing mail queue.

/var/spool/mail → another location for user’s mailbox.

/var/tmp → contains temporary files to be preserved between reboots.

One thought on “Linux File System Directory Architecture

Add yours

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Create a website or blog at

Up ↑

%d bloggers like this: