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
| Directory | Description |
|---|---|
/ | Root directory. The top of the file system tree. |
/bin | Essential command binaries (e.g., ls, cp, mv, bash) needed for single-user mode. |
/boot | Static files for boot loader (e.g., GRUB), kernel files (vmlinuz, initrd.img). |
/dev | Device files (e.g., /dev/sda, /dev/null). |
/etc | System-wide configuration files (e.g., /etc/fstab, /etc/hostname). |
/home | Default location for user home directories (/home/user). |
/lib | Essential shared libraries for binaries in /bin and /sbin. |
/lib64 | 64-bit system libraries (used on 64-bit systems). |
/media | Temporary mount point for removable media (CD-ROM, USB). |
/mnt | Temporarily mounted file systems (admin-defined). |
/opt | Optional or third-party software packages. |
/proc | Virtual file system exposing kernel and process information. |
/root | Home directory of the root user. |
/run | Temporary runtime data (since boot). |
/sbin | System binaries used for system administration. |
/srv | Data for services provided by the system (e.g., HTTP, FTP). |
/sys | Virtual filesystem exposing devices and kernel info (sysfs). |
/tmp | Temporary files (cleared on reboot). |
/usr | Secondary hierarchy for user applications and files. |
/var | Variable 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 likemessages,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 /etcExplanation:
drwxr-xr-x.:dis 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 -hShow memory usage:
free -hShow partition layout:
lsblkShow mount points:
mount | column -tIdentify filesystem type:
df -TLogical 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
/tmpand/var/tmpto save space. - Keep
/bootclean (old kernels can fill space). - Use
du -sh *to check directory sizes. - Monitor disk usage with
df -hand inode usage withdf -i.
Last updated on