Linux File System Hierarchy

The Linux Foundation maintains Linux Filesystem Hierarchy Standard (FHS). It defines the directory structure and contents in a UNIX-like operating system.

In the FHS, all files and directories should under the root directory, even those are store on the different physical or virtual device. The root directory denoted by the symbol “/.”

The UNIX/Linux operating system has the following directory structure.

/bin – Command Binaries

/boot – Static files for boot loader

/dev – Device Files

/etc – System configuration files

/home – User’s home directories

/lib – Shared Libraries

/media – Removable media

/mnt – Mounted Filesystem

/opt – Application software packages

/sbin – System Binaries

/srv – Data for service from system

/tmp – Temporary Files

/usr – User Utilities and Applications

/proc – Process Information

/ (root)

The root is the first directory in a directory structure.

Every files and directory starts from the root directory.

Only the root user of the system has the right to write under the root (/) directory.

One another directory with name root is under the root directory (/root) is the home directory of the root user.

/bin

It is essential to command binary files location, where all command’s binary files are stored, and we are using these command because “/bin” added in the environment variable “$PATH.”

/bin directory stored the commands like cat, ls, cp, grep, etc.

/boot

It stores all information about boot loader.

Kernel initd, vmlinux, grub files are located into /boot directory.

/dev

The /dev directory known as device files directory. It includes terminal devices, USB, or any device attached to the system. E.g., /dev/tty1, /dev/usbmon0.

/etc

It contains all system and program configuration files.

It also contains start-up and shutdown scripts for a program used with start/stop individually.

Configuration file examples are “/etc/resolv.conf”, “/etc/apache2/apache2.conf”, etc.

Program script examples are “/etc/init.d/apache2”, “/etc/init.d/cron”, etc.

/home

The /home directory contains the user’s home directories, personal files, user’s personal settings, etc.

Example: /home/linuxconcept, /home/satish etc.

/lib

It stores libraries essential files for the binaries in /bin and /sbin.

Library filenames are either start with ld or lib.
Example: ld-1.32.1.so, libncron.so.7.3

/media

The /media directory used as a mount point for a removable device such as CD-ROM.

It is temporary mount point for removable device such as /media/cdrom, /media/floppy, or /media/cdrecorder etc.

/mnt

It is for a temporarily mounting filesystem, where system admin can mount a file system.

/opt

The /opt directory used for optional application software packages.

Users can install add-on application under the /opt or /opt/ sub-directory.

/sbin

It is like /bin directory containing binary files related to the system.

The /sbin directory is storing Linux operating system related binaries executable. E.g., iptables, fdisk, ifconfig, etc.

/srv

The srv stands for service.

The /srv directory contains server specific services related data, e.g., /srv/cvs stores CVS related data.

/tmp

The /tmp directory stores files which are created by system or user for a temporary purpose. So, on system reboot, all files from this directory will be deleted.

/usr

The /usr directory contains libraries, binaries, documentation, and source code for a second-level program.

The /usr/bin directory stores binary files for the user’s program. If binary not found in /bin, you should look into /usr/bin.

The /usr/sbin directory stores binary files for system admin. If system binary not found in /sbin, you should look into /usr/sbin.

The /usr/lib contains libraries files for /usr/bin and /usr/sbin.

The /usr/local stores users program which you have installed from source.

The /usr/src contains the Linux kernel source, header-files, and documentation.

/proc

The /proc directory stores information about system process.

It is a pseudo filesystem stores information about the running process.

It is a virtual filesystem that contains system resources information in text format. E.g., /proc/uptime.

The new Linux operating system includes a new directory /run as a temporary filesystem to store runtime data.

0 Comments

Submit a Comment

Your email address will not be published. Required fields are marked *

6 + 7 =

Related Articles