Linux Filesystem Hierarchy

Linux Filesystem Hierarchy

I still remember the first time I switched to Linux and wondered what are all these folders and what files they contain. So what's a better way than to write a blog on what I learned for all those who might have had the same thought?


It is the base directory in the Linux filesystem which contains the entire system files. It is the parent directory to all the other directories. It is represented by /. Only the root user can modify files in this.

Bin Directory

The basic programs and command binary files reside in this directory. The commands included are cp, mv, mkdir, and date commands located in the /bin directory.

Boot Directory

It contains the bootloader files or startup files. Startup files are files that are executed when a system starts or boots up. The BIOS when loads first executes the boot code from the boot device, which is located in the first sector of the hard disk. In Linux, this is located in the /boot file system.

Home Directory

The directory "/home" is the location that contains the home directories for all users except for the root user. All the saved files and personal settings are present in /home.

Dev Directory

Dev directory comprises of the device files. Whenever you connect an external device in the system a device node or a new directory is dynamically created for the newly attached drive. /dev also contains /dev/null which is referred to as the bit bucket. The place where you dump anything you don't need.

Run Directory

The /run directory is a temporary filesystem that is typically used to store volatile runtime data. It contains information that is specific to the current boot session and is not intended to persist across reboots.

Etc Directory

The /etc is a very important directory that stores most of the configuration files in Linux. It also contains the access control files in which the access that is provided to a user, group, and others is given.

Lib Directory

It is used to store essential shared library files that are required by the system and various programs installed on the system. It contains runtime libraries used by the operating system kernel and other system utilities.

Media Directory

All external media is mounted under the /media file system. Ex- External hard drives This directory contains files for devices such as external hard disks, mice, and keyboards.

Mnt Directory

The /mnt directory serves as a temporary mount point for temporarily mounting file systems or storage devices. It is generally useful in mounting external storage devices like USB drives, network shares, or disk partitions.

Proc Directory

It contains all the information about currently running system processes and system resources in the form of files. It provides access to real-time information such as CPU usage, memory utilization, and kernel configuration. It contains numeric directories which represent a process associated with it.

Root Directory

The root user's home directory. It is located at "/root". This directory is separate from other users' directories to protect and maintain important files.

Opt Directory

Third-party programs which are optional and do not come with the operating system are installed in the /opt file system. Opt stands for optional. These are installed separately so that they do not interfere with the system files.

Tmp Directory

The /tmp directory is used to store temporary data created by users or applications. Files under this directory are used for short-term storage and get deleted when the system is rebooted.

Usr Directory

In older systems, the /usr directory was used for user home directories. However, in the modern Linux operating systems, it is the location where all user and application data reside. Examples of these applications are the Thunderbird mail client, Mozilla Firefox, VI Test Editor, etc. It is one of the largest directories in the Linux Filesystem.

Var Directory

It contains all the variable files whose data changes over time because of new data being generated. Backup, log files, temporary files, cache files, and many other data files that increase in size over time.


In this blog post, we learned about Linux Filesystem. I hope you all learned something from it and if so do like and share it. Connect with me on Twitter.

Did you find this article valuable?

Support Sachin Sharma by becoming a sponsor. Any amount is appreciated!