DEV Community

Cover image for Linux Directory Structure Overview
Dominic Koech
Dominic Koech

Posted on

Linux Directory Structure Overview

Linux is an extremely useful tool, particularly for developers and cybersecurity professionals. Knowing the ins and outs of the Linux system and how things are organized in it is thus advantageous.
In this article, I'll walk you through the Linux file system's directory structure. This article is intended for people who are still new to the Linux operating system.

In the design of its system, Linux employs the Filesystem Hierarchy Standard (FHS). In this standard, all system files and directories are stored in the root directory(/), regardless of whether they are on virtual or physical devices.


This is the top-level directory. It contains all of the files in your Linux file system. It is similar to the C: directory in Windows.


This directory contains boot-related files. These are the files that are required to boot the system. Before the kernel begins executing user-mode programs, data found here is processed. Grub Boot loader files and vmlinux are two examples of such files.


This directory contains essential user binaries, also known as "executable programs" by some. One thing to keep in mind is that /bin contains shells such as bash and zsh, as well as common Linux commands such as ps, ls, rm, and so on that all users can use. Browsers and other binaries are kept in /usr/bin/.


Device files are stored in the /dev directory. Device files are hardware devices that are connected to your Linux system and with which applications interact via I/O system calls. This demonstrates an important aspect of the Linux filesystem: everything is either a file or a directory.
The /dev/null device file is one to be aware of. Anything sent here vanishes; it's like a "black hole."


This directory contains Linux System configuration files, such as boot loader configuration files.

  • /etc/opt stores configuration for add-on packages

  • /etc/SGML stores configuration for  software that processes SGML

  • /etc/xll stores configuration for the X Window System

  • /etc/XML stores configuration for software that processes XML

  • /etc/passwd stored encrypted user passwords

Configuration files affecting specific users are in the user's home directory.


This directory contains each user's home folder. The data and configuration files are stored in folders named after the user's username.


This directory contains kernel modules and shared system libraries required by /bin and /sbin. The filenames in this directory are in the ld* or lib*.so.* format.


Any corrupted files discovered while rebooting are saved in this directory. This allows you to recover as much data as possible.


This is the location where removable devices are mounted. USB disks, CD/DVD ROM (mounted at /media/cdrom), floppy disks (mounted at /media/floppy), and other similar devices are examples. The contents of those devices are accessible from this page. ### /media

This is the location where removable devices are mounted. USB disks, CD/DVD ROM (mounted at /media/cdrom), floppy disks (mounted at /media/floppy), and other similar devices are examples. The contents of those devices are accessible from this page.


This is where sysadmins mount temporary file systems while using them. Network shares are one example.


Packages for add-on applications can be found here. These are proprietary/third-party applications that are not available in the distribution repository.


It contains data on system processes, the kernel, and configuration parameters. Because it is a virtual filesystem, it does not contain any'real' files.


This is the root user's home directory. It should be noted that only the root user has permission to write in this directory.


It saves volatile data that occurs during runtime.


This directory contains binaries that a system administrator uses to perform system maintenance and/or administrative tasks.


This directory contains data files for the system's services. For example, apache server or FTP server website files.


Modern Linux systems include this directory. It's a virtual filesystem that stores data on hardware devices, drivers, and kernel features.


The system or the user creates the temporary application files in this store. Every time the system reboots, these files are deleted.


Users' binaries, programs, utilities, and files are stored in this directory.

  • User binary files are located in /usr/bin.

  • System binaries used by system administrators, such as sshd and userdel, are located in /usr/sbin.

  • /usr/lib contains libraries for /usr/bin and /usr/sbin.

  • Source-installed programs are located in /usr/local.

  • The standard include files are located in /usr/include.

  • The kernel's source code can be found in /usr/src.

  • Documentation that is shared by all libraries can be found in /usr/share.


This directory contains variable files. These are files whose contents will be changed as the system runs. System log files, lock files, print queues, and so on are examples of such files.

  • /var/cache - This directory stores cached files from application programs.

  • /var/lib - This directory contains dynamic data libraries and files.

  • /var/log - This directory contains log files.

  • /var/opt - variable data of /opt/ packages

  • /var/mail - This directory stores mailbox files.

  • /var/spool - Queued tasks are stored in this directory.

  • /var/run - Stores information about the system since it was booted up.

  • /var/tmp - It stores temporary files saved between system reboots.

  • /var/log - This directory contains lock files created by programs to indicate that a specific file or device is in use.


I hope this article has given you a general understanding of how top-level Linux directories are organized.

I appreciate your time.

Top comments (0)