Listen to this Post
Linux follows the Filesystem Hierarchy Standard (FHS), where everything starts from `/` (root). Here’s a detailed breakdown of key directories and their purposes:
Root Directory (`/`)
- The base of the entire filesystem.
- All other directories branch from here.
Essential Directories:
1. `/bin` – Essential user binaries (e.g., ls, cp, mv).
2. `/boot` – Bootloader files (e.g., kernel, GRUB configs).
3. `/dev` – Device files (e.g., `/dev/sda`, `/dev/null`).
4. `/etc` – System-wide configuration files (e.g., /etc/passwd, /etc/fstab).
5. `/home` – User home directories (e.g., `/home/user`).
6. `/lib` & `/lib64` – Shared system libraries.
7. `/media` & `/mnt` – Mount points for removable media (USB, HDDs).
8. `/opt` – Third-party software installations.
9. `/proc` & `/sys` – Virtual filesystems for kernel and system info (e.g., /proc/cpuinfo).
10. `/root` – Home directory for the root user.
11. `/run` – Runtime process data (cleared on reboot).
12. `/sbin` – System binaries (e.g., `fsck`, `iptables`).
13. `/srv` – Service-related data (e.g., web, FTP).
14. `/tmp` – Temporary files (auto-cleared periodically).
15. `/usr` – User programs (e.g., /usr/bin, /usr/lib, /usr/local).
16. `/var` – Variable data (logs, mail, databases).
You Should Know:
Essential Linux Commands for Navigating FHS
– `ls /` – List root directory contents.
– `cd /etc` – Navigate to the configuration directory.
– `df -h` – Check disk space usage.
– `mount /dev/sdb1 /mnt` – Mount a USB drive.
– `cat /proc/cpuinfo` – View CPU details.
– `sudo find / -name “filename”` – Search for a file.
– `sudo du -sh /var/log` – Check log directory size.
Windows Equivalent Commands (For Comparison)
– `dir C:\` – List root directory contents.
– `cd C:\Windows\System32` – Navigate to system binaries.
– `wmic diskdrive get size` – Check disk size.
– `systeminfo` – View system details.
What Undercode Say:
Understanding the Linux Filesystem Hierarchy is crucial for system administration, cybersecurity, and troubleshooting. Key takeaways:
– Security: `/etc` contains critical configs—always back up before changes.
– Logs: `/var/log` holds system logs—monitor for intrusions.
– Temporary Files: `/tmp` is world-writable—potential attack surface.
– Permissions: Use `chmod` and `chown` to secure sensitive directories.
Advanced Commands for Security & Maintenance
– `sudo chmod 700 /root` – Restrict root access.
– `sudo chown root:root /etc/shadow` – Secure password hashes.
– `journalctl -u sshd` – Check SSH login attempts.
– `sudo lsof /var/log/syslog` – Identify processes using logs.
– `grep -r “error” /var/log` – Search for errors in logs.
Expected Output:
A well-structured Linux system adheres to FHS, ensuring consistency across distributions. Mastering these directories and commands enhances efficiency in administration, security hardening, and debugging.
🔗 Further Reading:
🚀 Now go explore your Linux system!
References:
Reported By: Kaaviya Balaji – Hackers Feeds
Extra Hub: Undercode MoN
Basic Verification: Pass ✅



