Linux Directory Structure

In this tutorial, we will learn about the Linux Directory Structure. The Linux filesystem is a hierarchical filesystem. The Filesystem Hierarchy Standard (FHS) defines the names of files and directories and their locations on Linux systems. FHS collaborative document that specifies a set of guidelines.

A single fixed disk can store thousands of files. The operating system provides a file system for organizing data by grouping files on the disk.

As we know Linux is inspired by UNIX. Linux follows the UNIX filesystem convention. When Unix was developed, it had features that the other operating systems at the time did not have. One such feature was the filesystem. The Unix filesystem has a hierarchical structure and files can be stored under directories. Directories are similar to the drawers of a filing cabinet. Just as each drawer contains files, each of which contains data of a similar nature. Just as in a filing cabinet, the user decides the drawer labels and contents, so also, the user decides the directory name and files in a directory name and files in a directory.

Linux Directory Structure


In Linux Directory Structure, files and directories are organized into a single rooted inverted-tree structure, including different physical storage, i.e. USB Drive, CD/DVD Drives etc. In Linux Directory Structure, the Filesystem begins at the root directory. A forward slash (/) separates elements of pathnames, i.e. /home/Ruban. Please note, that names in the Linux directory structure are case-sensitive.

The following section describes the topmost directory in Linux File System Hierarchy, followed by subdirectories.

/ Directory

The topmost directory in a Linux file system is the root directory, denoted by a single forward slash (/). The root filesystem only contains other directories but no individual files. Files and directories are organized into a single-rooted inverted tree structure.

Root Linux Directory Structure

/bin Directory

The /bin Directory stores executable programs, and common system utility Commands in Binary format. Linux Commands that are used by all system users, i.e. cat, cd, clear, date, df, echo, mkdir, ls, pwd, rmdir, vi etc. stored under the /bin directory.

Bin Directory Linux File Hierarchy

/boot Directory

The /boot Directory stores the files necessary to boot the Linux operating system. The boot loaders, kernel configuration files, are stored in /boot.

Boot Directory Linux Directory Structure

/dev Directory

The /dev Directory stores device-related files to address peripherals for the system. I.e. hardware and software device drivers. Linux considers devices as a file and the /dev directory maintains file system entries that represent the devices connected to the system. For example, the /dev/sda1 partition represents SATA Drive in the system.

Dev Directory Linux File System Hierarchy

/etc Directory

The /etc Directory stores most of the system-related configuration data that users and the system need to refer to, such as the passwd file.

/etc Directory In Linux

/home Directory

The /home Directory generally contains all the Home directories including the users’ personal files. Most non-root home directories are stored under /home.

When you create a user on a Linux system, the Home directory for the new user is created by default under /Home. For example, in a system, two users are created, Ruban and Ofbit. Their home directories will be /home/Ruban and /home/Ofbit. Each directory with a User name contains directories for personal files, i.e. Desktop, Documents, Downloads, Music, Pictures, etc. and user-specific configuration files.

Linux /home directory

/lib Directory

The /lib Directory contains data libraries for the compilers installed in the system. Stores shared program libraries required by the kernel, command-line utilities, and binaries. The /lib directory stores the libraries that are required by the binaries in the /bin and /sbin directories.

/lib directory Linux File Structure

/media Directory

The /media Directory stores mount points for removable media such as USB Drives, SD Cards, CD-ROMs etc. Once you connect any removable media, a subdirectory is automatically created under the /media Directory.

/mnt Directory

The /mnt Directory stores the temporary mount directory which is a mount point for temporarily mounting file systems. Unlike the /media directory, the /mnt directory is usually used by the Administrators to manually mount a filesystem.

/Mnt Directory Linux Directory Structure

/opt Directory

The /opt Directory stores optional files of third-party large software packages which are usually not available under the official distribution’s repository. Upon installation, these packages normally create a subdirectory under /opt directory.

/proc Directory

The /proc Directory stores information about the running Linux system process. It is a virtual and pseudo filesystem that tracks information about the system process with a specific process ID or PID. And home for system information such as memory usage, processor information, etc.

/Proc Directory Linux File Hierarchy

/root Directory

The /root directory is the root user’s home directory.

/Root Directory Linux File System Hierarchy

/run Directory

The /run Directory stores Variable and volatile run-time data.

Linux /Run Directory

/sbin Directory

The /sbin Directory stores system binary (executable) files that are used for completing the booting process and also the ones that are used by the root user for system administration.

/SBIN Directory File 
System Structure

/srv Directory

The /srv Directory stores data from system services.

/sys Directory

The /sys Directory stores Device, Driver, and kernel information. Also, a new sysfs virtual filesystem specific to the 2.6 kernel, allows support for hot plug hardware devices.

/tmp Directory

The /tmp Directory stores temporary files created by the System and User. The /tmp Directory is also used by applications for storing temporary data. Stored temporary files may be lost on system shutdown.

/Tmp Directory Linux Directory Structure

/usr Directory

The /usr Directory stores the operating system files, which are not involved in the boot process. The /usr directory is a read-only directory that stores executable files, libraries, system utilities, and files accessible to all users.

/Usr Directory Linux File System Structure

/var Directory

The /var Directory has information specific to different utilities of Linux. The /var directory stores variable files or regularly changing system files such as logs, printer spools, queues, and some networking services configuration files.

/Var Directory Linux File Structure

In this tutorial, we have learned about the Linux Directory Structure. I hope this tutorial helps you to understand the Linux file system hierarchy.

Discover More on Linux.

Follow us:


If you like our articles and tutorials, you can follow us on Facebook. Also, join our Official Facebook Group for QnA sessions and Discussions with the worldwide technical community.

Related posts

Leave a Comment