Linux Directory Structure
Last Updated :
07 Jun, 2025
In Linux, everything is treated as a file even if it is a normal file, a directory, or even a device such as a printer or keyboard. All the directories and files are stored under one root directory which is represented by a forward slash /.
The Linux directory layout follows the Filesystem Hierarchy Standard (FHS). This standard defines how directories are organized and what types of files should be stored in each. Since Linux is based on UNIX, it inherits many of its filesystem conventions. Similar directory structures can also be found in other UNIX-like operating systems such as BSD and macOS. Understanding the Linux directory structure is essential for efficient system administration, file management, and problem-solving.
Types of files in the Linux system
Linux categorizes files into different types based on their purpose, such as general data storage, system structure, or device representation.
- General Files - It is also called ordinary files. It may be an image, video, program, or simple text file. These types of files can be in ASCII or Binary format. It is the most commonly used file in the Linux system.
- Directory Files - These types of files are a warehouse for other file types. It may be a directory file within a directory (subdirectory).
- Device Files - In a Windows-like operating system, devices like CD-ROM and hard drives are represented as drive letters like F: G: H, whereas in the Linux system, devices are represented as files. As for example, /dev/sda1, /dev/sda2, and so on.
We know that in a Windows-like operating system, files are stored in different folders on different data drives like C: D: E:, whereas in the Linux/Unix operating system, files are stored in a tree-like structure starting with the root directory, as shown in the diagram below.Â
data storage in Linux/Unix operating systemsThe Linux/Unix file system hierarchy base begins at the root and everything starts with the root directory.Â
Also Read: Linux File Hierarchy Structure
Top-level directories associated with the root directory
These top-level directories under the root (/
) form the foundation of the Linux file system, each serving a specific role in organizing system files, user data, and configurations.
Directories | Description |
---|
 /bin |  binary or executable programs. |
---|
/etc | system configuration files. |
---|
/home | home directory. It is the default current directory. |
---|
/opt | optional or third-party software. |
---|
/tmp | temporary space, typically cleared on reboot. |
---|
/usr | Â User related programs. |
---|
/var | log files. |
---|
Some other directories in the Linux system
These directories support core functionality, hardware access, runtime processes, and system-level operations in a Linux environment.
Directories | Description |
---|
/boot | It contains all the boot-related information files and folders such as conf, grub, etc. |
---|
/dev | It is the location of the device files such as dev/sda1, dev/sda2, etc. |
---|
/lib | It contains kernel modules and a shared library. |
---|
/lost+found | It is used to find recovered bits of corrupted files. |
---|
/media | It contains subdirectories where removal media devices are inserted. |
---|
/mnt | It contains temporary mount directories for mounting the file system. |
---|
/proc | It is a virtual and pseudo-file system to contains info about the running processes with a specific process ID or PID. |
---|
/run | It stores volatile runtime data. |
---|
/sbin | binary executable programs for an administrator. |
---|
/srv | It contains server-specific and server-related files. |
---|
/sys | It is a virtual file system for modern Linux distributions to store and allows modification of the devices connected to the system. |
---|
Exploring directories and their usability
We know that Linux is a very complex system that requires an efficient way to start, stop, maintain and reboot a system, unlike Windows operating system. In the Linux system some well-defined configuration files, binaries, main pages information files are available for every process.Â
Linux Kernel File:
- /boot/vmlinux - The Linux kernel file.
Device Files:
- /dev/hda - Device file for the first IDE HDD.
- /dev/hdc - A pseudo-device that output garbage output is redirected to /dev/null.
System Configuration Files
A collection of essential configuration files in the /etc
directory that define system behavior, user access, boot settings, network rules, and service management in Linux.
Configuration Files | Description |
---|
/etc/bashrc | It is used by bash shell that contains system defaults and aliases. |
---|
/etc/crontab | A shell script to run specified commands on a predefined time interval. |
---|
/etc/exports | Â It contains information on the file system available on the network. |
---|
/etc/fstab | Information of the Disk Drive and their mount point. |
---|
/etc/group | Â It is a text file to define Information of Security Group. |
---|
/etc/grub.conf | It is the grub bootloader configuration file. |
---|
/etc/init.d | Â Service startup Script. |
---|
/etc/lilo.conf |  It contains lilo bootloader configuration file. |
---|
/etc/hosts | Information of IP and corresponding hostnames |
---|
/etc/hosts.allow | It contains a list of hosts allowed accessing services on the local machine. |
---|
/etc/host.deny | Â List of hosts denied accessing services on the local machine. |
---|
/etc/inittab | Â INIT process and their interaction at the various run levels. |
---|
/etc/issue | Allows editing the pre-login message. |
---|
/etc/modules.conf | It contains the configuration files for the system modules. |
---|
/etc/motd | Â It contains the message of the day. |
---|
/etc/mtab | Currently mounted blocks information. |
---|
/etc/passwd |  It contains username, password of the system, users in a shadow file. |
---|
/etc/printcap |  It contains printer Information. |
---|
/etc/profile | Â Bash shell defaults. |
---|
/etc/profile.d | It contains other scripts like application scripts, executed after login. |
---|
/etc/rc.d | Â It avoids script duplication. |
---|
/etc/rc.d/init.d | Â Run Level Initialisation Script. |
---|
/etc/resolv.conf | DNS being used by System. |
---|
/etc/security | Â It contains the name of terminals where root login is possible. |
---|
/etc/skel | Script that initiates new user home directory. |
---|
/etc/termcap | An ASCII file that defines the behavior of different types of the terminal. |
---|
/etc/X11 | Directory tree contains all the conf files for the X-window System. |
---|
These directories under /usr
contain essential user-space programs, libraries, headers, and shared data used by both regular users and administrators.
User Related Files | Descriptions |
---|
/usr/bin | Â It contains most of the executable files. |
---|
/usr/bin/X11Â | Symbolic link of /usr/bin. |
---|
/usr/include | Â It contains standard files used by C program. |
---|
/usr/share | It contains architecture independent shareable text files. |
---|
/usr/lib | Â It contains object files and libraries. |
---|
/usr/sbin | It contains commands for Super User, for System Administration. |
---|
These /proc
files provide real-time system and process information generated dynamically by the Linux kernel.
Virtual and Pseudo Process Related Files | Descriptions |
---|
/proc/cpuinfo | CPU Information |
---|
/proc/filesystems | It keeps useful info about the processes that are currently running. |
---|
/proc/interrupts | Â it keeps the information about the number of interrupts per IRQ. |
---|
/proc/ioports | Contains all the Input and Output addresses used by devices on the server |
---|
/proc/meminfo | It reports the memory usage information. |
---|
/proc/modules | Currently using kernel module. |
---|
/proc/mount | Mounted File-system Information. |
---|
/proc/stat | It displays the detailed statistics of the current system. |
---|
/proc/swaps | Â It contains swap file information. |
---|
Quickly view the current Linux OS version using this file.
- /version - It displays the Linux version information.
Log Files
These files record crucial system events, logins, and activity history for monitoring and troubleshooting.
Log Files | Descriptions |
---|
/var/log/lastlog | Â It stores user's last login info. |
---|
/var/log/messages | Â It has all the global system messages |
---|
/var/log/wtmp | It keeps a history of login and logout information. |
---|
To check the Linux directories, open the terminal and execute sudo -s followed by system password to give root privilege. Then after changing the current home directory to the root directory and check the list of all available directories in the base directory as shown below.Â
 Linux directoriesConclusion
If we understand the Linux directory's structure correctly, it would be so easy to effectively navigate and manage our filesystem, locate important configuration files, and access system information. One must know that the directory structure and specific file mentioned in this article are based on standard Linux conventions. We must consider that the different Linux distributions may have variations in the directory structure and specific file locations, but overall concept and organization remain similar.
Similar Reads
Introduction to Linux Shell and Shell Scripting If we are using any major operating system, we are indirectly interacting with the shell. While running Ubuntu, Linux Mint, or any other Linux distribution, we are interacting with the shell by using the terminal. In this article we will discuss Linux shells and shell scripting so before understandi
8 min read
Introduction to Shell Scripting
Basic Shell Commands in Linux
Basic Shell Commands in Linux: Complete ListAnyone using Linux should become an expert in the essential shell commands, as they form the backbone of working with the Linux terminal. These commands enable you to navigate the system, manage files, handle processes, and configure settings effectively.The Linux shell serves as an interface for us
5 min read
Linux Directory StructureIn Linux, everything is treated as a file even if it is a normal file, a directory, or even a device such as a printer or keyboard. All the directories and files are stored under one root directory which is represented by a forward slash /. The Linux directory layout follows the Filesystem Hierarchy
6 min read
Input Output Redirection in LinuxIn Linux, whenever an individual runs a command, it can take input, give output, or do both. Redirection helps us redirect these input and output functionalities to the files or folders we want, and we can use special commands or characters to do so. For example, if we run the "date" command, it giv
4 min read
Variables and Data Types
Control Structures
Functions and Script Organization
Input And Output
Command-Line Arguments and Options
Error Handling and Debugging
Regular Expressions