Skip to content

Linux Filesystem

Everything branches from / (root). The structure follows the FHS standard across most distros.

DirectoryPurposeNotable contents
/Root of the filesystemEverything lives under here
/etcSystem configuration filespasswd, shadow, ssh/, crontab, hosts, fstab
/varVariable data (logs, caches, spools)log/, www/, mail/, tmp/
/tmpTemporary files (world-writable, cleared on reboot)Scratch space for scripts, exploits, uploads
/homeUser home directories~/.ssh/, ~/.bashrc, ~/.bash_history
/rootRoot user’s home directoryOften has .bash_history, configs
/optOptional/third-party softwareManually installed apps
/usrUser binaries and librariesbin/, sbin/, lib/, share/, local/
/binEssential user commandsls, cp, cat, grep (often symlinked to /usr/bin)
/sbinEssential system commandsiptables, fdisk, mount (often symlinked to /usr/sbin)
/devDevice filesnull, zero, random, sda, tty
/procVirtual filesystem — process and kernel infocpuinfo, meminfo, version, [PID]/
/sysVirtual filesystem — hardware/driver infoKernel parameters, device attributes
/bootBootloader and kernel imagesvmlinuz, grub/
/mntTemporary mount pointsManual mounts
/mediaRemovable media mount pointsUSB drives, CDs
/srvService dataWeb server roots, FTP data
/runRuntime data since last bootPID files, sockets

Terminal window
cat /etc/passwd # User accounts (readable by all)
cat /etc/shadow # Password hashes (root only)
cat /etc/group # Groups and members
cat /etc/hostname # Machine name
cat /etc/hosts # Static hostname mappings
cat /etc/resolv.conf # DNS servers
cat /etc/crontab # System cron jobs
ls -la /etc/cron.* # Cron directories
cat /etc/ssh/sshd_config # SSH server config
cat /etc/fstab # Filesystem mounts (may reveal NFS shares)
Terminal window
ls /var/log/ # System logs
ls /var/www/ # Web server files (if web hosting)
ls /var/spool/cron/ # Per-user crontabs
ls /var/mail/ # User mailboxes
ls /var/backups/ # Backup files

/tmp and /dev/shm — world-writable scratch space

Section titled “/tmp and /dev/shm — world-writable scratch space”
Terminal window
ls -la /tmp/ # Temp files — writable by anyone
ls -la /dev/shm/ # Shared memory — tmpfs, writable, in RAM

Both are useful for staging files during exploitation. /dev/shm is in memory (fast, no disk writes).

Terminal window
cat /proc/version # Kernel version
cat /proc/cpuinfo # CPU info
cat /proc/meminfo # Memory info
cat /proc/net/tcp # Active TCP connections (hex-encoded)
ls /proc/[0-9]*/ # Running processes
cat /proc/self/environ # Current process environment variables
cat /proc/self/cmdline # Current process command line
Terminal window
ls -la /home/*/ # All user home dirs
cat /home/*/.bashrc # Shell configs
cat /home/*/.bash_history # Command history
ls -la /home/*/.ssh/ # SSH keys
cat /home/*/.ssh/authorized_keys

Terminal window
df -h # Disk usage by filesystem
du -sh /var/log/ # Size of a directory
mount # Show mounted filesystems
lsblk # Block devices
findmnt # Show mount tree