Problem Statement
Explain the Linux filesystem hierarchy. What are the purposes of /home, /var, /usr, /tmp, and /opt directories?
Explanation
The /home directory contains user home directories where personal files, documents, and user-specific configurations are stored. Each user typically has a subdirectory like /home/username with their files and settings. This separation keeps user data isolated and makes backups easier.
/var stores variable data that changes during system operation including log files (/var/log), mail spools (/var/mail), print queues, and temporary files that persist across reboots. It's crucial for system monitoring and troubleshooting since application logs accumulate here. /var can grow large so it's often on a separate partition.
/usr contains user programs and data shared across users including /usr/bin for user commands, /usr/lib for libraries, /usr/local for locally installed software, and /usr/share for shared data. Most application binaries and libraries live here. /tmp stores temporary files that may be deleted on reboot, used by applications for transient data. /opt contains optional third-party software packages installed as complete subdirectories.
Understanding the filesystem hierarchy helps with system administration, troubleshooting (knowing where logs are), software installation, and backup strategies. The Filesystem Hierarchy Standard (FHS) defines these conventions ensuring consistency across Linux distributions.
