Linux Filesystem Hierarchy Overview
The Filesystem Hierarchy organizes everything as files under the root /. Knowing where things live helps with troubleshooting, backups, and automation.
Key Directories
- / – Root of the filesystem
- /bin – Essential user binaries
- /sbin – System binaries (admin)
- /boot – Boot loader & kernel
- /etc – System-wide configuration
- /home – User home directories
- /lib, /lib64 – Shared libraries
- /usr – User-space apps & read-mostly data
- /var – Variable data (logs, spool, DBs)
- /tmp – Temporary files
- /opt – Optional third-party software
- /dev – Device files
- /proc, /sys – Virtual kernel & device info
- /mnt, /media – Mount points / removable media
Package Management on Debian-based Systems
Debian/Ubuntu use APT (Advanced Package Tool) to query, install, and update software from repositories defined in /etc/apt/sources.list (and files in /etc/apt/sources.list.d/).
Common APT Commands
sudo apt update # Refresh package lists
sudo apt upgrade # Upgrade installed packages
sudo apt install <pkg> # Install a package
sudo apt remove <pkg> # Remove (keep configs)
sudo apt purge <pkg> # Remove incl. configs
apt search <term> # Search available software
Low-Level: dpkg
dpkg works directly with .deb files and the local package database.
sudo dpkg -i package.deb # Install a .deb
sudo dpkg -r <name> # Remove (keep configs)
sudo dpkg -P <name> # Purge (remove configs)
dpkg -l # List installed packages
Managing System Services (systemd)
systemd is the init system & service manager on most modern distros. You interact with it using systemctl and view logs via journalctl.
Common systemctl & journalctl Commands
systemctl status <service> # Check status
sudo systemctl start|stop|restart <service>
sudo systemctl enable|disable <service> # Manage autostart
journalctl -u <service> # Service logs
Process Management
Processes are running programs; each has a PID and consumes CPU/memory. Use these commands to inspect and control them.
Process Commands
ps aux # Snapshot of processes (BSD style)
top # Interactive live view
htop # Nicer top (if installed)
kill <PID> # Terminate by PID
pkill <name> # Terminate by name
jobs; bg; fg # Manage shell jobs
System Monitoring and Logging
System Info Commands
uname -a # Kernel and OS info
hostnamectl # Hostname and chassis info
lscpu # CPU details
free -h # Memory usage
Key Log Files
On Debian/Ubuntu, the most important logs are /var/log/syslog and /var/log/auth.log. The kernel ring buffer is accessible via dmesg.
Conclusion
These fundamentals — filesystem layout, packages, services, processes, and logs — form the day-to-day toolkit for Linux admins. Master them first, then layer on scripting, automation, and security hardening.