Home » Linux » Linux File System Hierarchy

Linux File System Hierarchy

Last updated Sep 4, 2021

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

  • Facebook
  • Twitter
  • reddit
  • LinkedIn

/ (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.

Related Posts

Creating a lame utility HTTP server in Linux Operating System

In this article, we will discuss the cURL tool in Linux. The cURL tool is used for transferring the data from or to a server. It supports many protocols, and http is one of them. cURL is used to transfer the data from URL. It has so many tricks to offer, such as http...

Finding binary dependencies in Linux Operating System

In this article, we are going to check the executable. We will find out which string is present in it by using the string command.PrerequisitesBesides having a terminal open, make sure you have a binary present in your directory.Find dependencies First, we...

Capturing network traffic headlessly in Linux Operating System

In this article, we are going to learn how to capture traffic. We are going to capture network traffic with a packet sniffer tool called tcpdump. This tool is used to filter or capture TCP/IP packets that are transferred or received over a network.PrerequisitesBesides...

Follow Us

Our Communities

More on Linux

The Ultimate Managed Hosting Platform
Load WordPress Sites in as fast as 37ms!

0 Comments

0 Comments

Submit a Comment

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

7 + 16 =

Shares