Home Linux Linux Directory Structure

Linux Directory Structure

by Anup Maurya
8 minutes read

The Linux directory structure is a standardized layout for organizing files and directories on Linux systems. It is based on the Filesystem Hierarchy Standard (FHS), which defines the recommended placement of files and directories for system-wide consistency.

The Linux directory structure is organized around the root directory, represented by the forward slash (/). All other files and directories reside within the root directory, forming a hierarchical tree structure.

These are the common top-level directories associated with the root directory:

DirectoriesDescription
 /bin binary or executable programs.
/etcsystem configuration files.
/homehome directory. It is the default current directory.
/optoptional or third-party software.
/tmptemporary space, typically cleared on reboot.
/usr User related programs.
/var log files.

Some other directories in the Linux system:

Directories Description
/bootIt contains all the boot-related information files and folders such as conf, grub, etc.
/devIt is the location of the device files such as dev/sda1, dev/sda2, etc.
/libIt contains kernel modules and a shared library.
/lost+foundIt is used to find recovered bits of corrupted files.
/mediaIt contains subdirectories where removal media devices are inserted.
/mntIt contains temporary mount directories for mounting the file system.
/procIt is a virtual and pseudo-file system to contains info about the running processes with a specific process ID or PID.
/runIt stores volatile runtime data.
/sbinbinary executable programs for an administrator.
/srv It contains server-specific and server-related files.
/sysIt 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:

Configuration FilesDescription
/etc/bashrcIt is used by bash shell that contains system defaults and aliases.
/etc/crontabA 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/fstabInformation of the Disk Drive and their mount point.
/etc/group It is a text file to define Information of Security Group.
/etc/grub.confIt is the grub bootloader configuration file.
/etc/init.d Service startup Script.
/etc/lilo.conf  It contains lilo bootloader configuration file.
/etc/hostsInformation of IP and corresponding hostnames
/etc/hosts.allowIt 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/issueAllows editing the pre-login message.
/etc/modules.confIt 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.dIt 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.confDNS being used by System.
/etc/security It contains the name of terminals where root login is possible.
/etc/skelScript that initiates new user home directory.
/etc/termcapAn ASCII file that defines the behavior of different types of the terminal.
/etc/X11Directory tree contains all the conf files for the X-window System.

User Related Files:

User Related FilesDescriptions
/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/shareIt contains architecture independent shareable text files.
/usr/lib It contains object files and libraries.
/usr/sbinIt contains commands for Super User, for System Administration.

Virtual and Pseudo Process Related Files:

Virtual and Pseudo Process Related FilesDescriptions
/proc/cpuinfoCPU Information
/proc/filesystemsIt keeps useful info about the processes that are currently running.
/proc/interrupts it keeps the information about the number of interrupts per IRQ.
/proc/ioportsContains all the Input and Output addresses used by devices on the server
/proc/meminfoIt reports the memory usage information.
/proc/modulesCurrently using kernel module.
/proc/mountMounted File-system Information.
/proc/statIt displays the detailed statistics of the current system.
/proc/swaps It contains swap file information.

Version Information File:

  • /version – It displays the Linux version information.

Log Files:

Log FilesDescriptions
/var/log/lastlog It stores user’s last login info.
/var/log/messages It has all the global system messages
/var/log/wtmpIt keeps a history of login and logout information.

related posts

Leave a Comment

Enable Notifications OK No thanks