Linux Root Directory Structure Explained

Listen to this Post

Featured Image
The root directory (/) is the foundation of the Linux filesystem hierarchy. Understanding its structure is essential for system administration, troubleshooting, and cybersecurity. Below is a breakdown of key directories and their purposes:

/ (Root Directory)

  • The top-level directory containing all other directories.

/home

  • Contains user directories (/home/username).
  • Command to list home directories:
    ls /home 
    

/usr

  • Stores user-installed programs and libraries.
  • Check installed software:
    dpkg -l  Debian/Ubuntu 
    rpm -qa  RHEL/CentOS 
    

/var

  • Holds variable data like logs (/var/log), caches, and temporary files.
  • View system logs:
    tail -f /var/log/syslog 
    

/tmp

  • Temporary files (cleared on reboot).
  • Secure /tmp with noexec:
    mount -o remount,noexec /tmp 
    

/etc

  • System-wide configuration files.
  • List all config files:
    ls -l /etc 
    

/bin & /sbin

  • Essential binaries (/bin for users, `/sbin` for admins).
  • Check binary paths:
    which ls 
    whereis ls 
    

/lib & /lib64

  • Shared libraries for applications.
  • Find missing libraries:
    ldd /usr/bin/nginx 
    

/mnt & /media

  • Mount points for external storage.
  • Mount a USB drive:
    mount /dev/sdb1 /mnt/usb 
    

/opt

  • Optional third-party software.
  • Check installed apps:
    ls /opt 
    

/proc

  • Virtual filesystem for running processes.
  • View process info:
    cat /proc/cpuinfo 
    

/sys

  • Kernel and hardware information.
  • List hardware devices:
    ls /sys/class/net 
    

You Should Know:

  • Permissions & Security:
    chmod 700 /home/username  Restrict home dir access 
    
  • Log Analysis for Intrusions:
    grep "Failed password" /var/log/auth.log 
    
  • Clearing Temp Files Securely:
    shred -u /tmp/sensitive_file 
    
  • Finding Suspicious Files:
    find / -type f -perm /4000  Find SUID files 
    
  • Backup Critical Configs:
    tar -czvf etc_backup.tar.gz /etc 
    

What Undercode Say:

Mastering Linux directory structure enhances cybersecurity posture. Key takeaways:
– Audit `/etc` for misconfigurations.
– Monitor `/var/log` for breaches.
– Restrict `/tmp` to prevent exploits.
– Use `find` to detect unauthorized files.
– Automate backups of critical directories.

Expected Output:

A well-structured Linux system with secure permissions, logged activities, and minimal attack surface.

(No relevant URLs extracted from the original post.)

References:

Reported By: Parasmayur Root – Hackers Feeds
Extra Hub: Undercode MoN
Basic Verification: Pass ✅

Join Our Cyber World:

💬 Whatsapp | 💬 Telegram