Skip to Content
This project is a work in progress. If you have any questions or suggestions, feel free to contact me.
LinuxFile SystemFile System Overview

Overview of Linux File System Hierarchy

The Linux file system is hierarchical, starting from the root directory /. Every file and directory stems from /.

The structure is standardized by the Filesystem Hierarchy Standard (FHS).

Top-Level Directories in RHEL

DirectoryDescription
/Root directory. The top of the file system tree.
/binEssential command binaries (e.g., ls, cp, mv, bash) needed for single-user mode.
/bootStatic files for boot loader (e.g., GRUB), kernel files (vmlinuz, initrd.img).
/devDevice files (e.g., /dev/sda, /dev/null).
/etcSystem-wide configuration files (e.g., /etc/fstab, /etc/hostname).
/homeDefault location for user home directories (/home/user).
/libEssential shared libraries for binaries in /bin and /sbin.
/lib6464-bit system libraries (used on 64-bit systems).
/mediaTemporary mount point for removable media (CD-ROM, USB).
/mntTemporarily mounted file systems (admin-defined).
/optOptional or third-party software packages.
/procVirtual file system exposing kernel and process information.
/rootHome directory of the root user.
/runTemporary runtime data (since boot).
/sbinSystem binaries used for system administration.
/srvData for services provided by the system (e.g., HTTP, FTP).
/sysVirtual filesystem exposing devices and kernel info (sysfs).
/tmpTemporary files (cleared on reboot).
/usrSecondary hierarchy for user applications and files.
/varVariable data like logs, mail, spool files, caches, etc.

Important Subdirectories

/etc – Configuration Files

Contains static system configuration. Examples:

  • /etc/hosts: Static hostname-to-IP mappings.
  • /etc/passwd: User account info.
  • /etc/systemd/: Systemd service units.

/var – Variable Files

Stores logs, mail, and spools.

  • /var/log/: System logs like messages, secure, dmesg.
  • /var/spool/: Tasks waiting for processing (e.g., cron, mail).
  • /var/tmp/: Persistent temporary files.

/proc – Kernel and Process Info

Dynamic, virtual files. Examples:

  • /proc/cpuinfo: CPU info.
  • /proc/meminfo: Memory usage.
  • /proc/[pid]/: Process-specific info.

/sys – Kernel Device Tree

Exposes devices and kernel attributes. Examples:

  • /sys/class/: Device classes like network or block.
  • /sys/block/: Block devices (e.g., sda, loop0).

ls -l / Sample Output Explanation (Red Hat)

$ ls -l / drwxr-xr-x. 2 root root 4096 Jul 21 /bin drwxr-xr-x. 4 root root 4096 Jul 21 /boot drwxr-xr-x. 19 root root 3920 Jul 22 /dev drwxr-xr-x. 122 root root 12288 Jul 22 /etc

Explanation:

  • drwxr-xr-x.: d is directory; permission bits follow.
  • 2: Number of hard links.
  • root root: Owner and group.
  • 4096: File size in bytes.
  • Jul 21: Last modified date.
  • /bin: File or directory name.

Exploring with Commands

List all top-level directories:

ls -l /

Show disk usage:

df -h

Show memory usage:

free -h

Show partition layout:

lsblk

Show mount points:

mount | column -t

Identify filesystem type:

df -T

Logical Volume Manager (LVM) – RHEL Feature

Red Hat often uses LVM for flexible disk management.

  • View volumes:
lvs vgs pvs
  • Configuration files:

    • /etc/lvm/lvm.conf

SELinux and Red Hat

RHEL enforces SELinux (Security-Enhanced Linux), which adds security labels to the filesystem.

  • Check status:
sestatus
  • Contexts:
ls -Z /

File System Tips for Red Hat Admins

  • Regularly check /var/log/ for troubleshooting.
  • Clean up /tmp and /var/tmp to save space.
  • Keep /boot clean (old kernels can fill space).
  • Use du -sh * to check directory sizes.
  • Monitor disk usage with df -h and inode usage with df -i.
Last updated on