How does the Linux filesystem hierarchy work with directories like /bin, /etc, /var?
Understand the Linux filesystem hierarchy and what /bin, /etc, /var, /usr and /home are for, with clear examples and interview-ready answers.
Expected Interview Answer
Linux organizes everything under a single root directory (/), and the Filesystem Hierarchy Standard (FHS) assigns each top-level directory a defined purpose so that programs and administrators know where to find and place files.
Instead of drive letters, every device and partition is mounted somewhere inside this one tree. /bin holds essential user command binaries, /etc holds host-specific configuration files, /var holds variable data like logs and spools, /home holds user directories, /usr holds the bulk of read-only programs and libraries, and /tmp holds temporary files. This predictable layout lets software, packages, and scripts rely on fixed locations across distributions.
- Predictable, standardized file locations across distributions
- Separates configuration, binaries, and variable data cleanly
- Single unified tree instead of per-drive letters
- Makes backups and permissions easier to reason about
- Lets packages and scripts rely on stable paths
AI Mentor Explanation
Think of a cricket stadium organized so every item has one fixed home: the dressing room for kit, the groundsman's shed for rollers and covers, the scorer's box for records. A visiting official never hunts around because the layout is standard at every ground. The Linux hierarchy works the same way — /bin, /etc, and /var are the fixed rooms, and anyone who knows the stadium plan finds what they need instantly.
Step-by-Step Explanation
Step 1
Start at root
Everything lives under a single / directory; there are no drive letters in Linux.
Step 2
Locate essential binaries
/bin (and /sbin) hold core command executables needed even in single-user mode.
Step 3
Find configuration
/etc holds host-specific, human-readable configuration files for the system and services.
Step 4
Track variable data
/var holds data that changes at runtime: logs, mail, print spools, and caches.
Step 5
Know the big stores
/usr holds most installed programs and libraries; /home holds per-user directories; /tmp holds transient files.
What Interviewer Expects
- Awareness of a single-rooted tree instead of drive letters
- Correct purpose of /bin, /etc, and /var
- Mention of the Filesystem Hierarchy Standard (FHS)
- Distinction between static and variable data
- That partitions and devices are mounted into the tree
Common Mistakes
- Confusing /etc (config) with binaries or logs
- Thinking Linux uses drive letters like C:
- Placing logs in /bin instead of /var
- Assuming /usr means user home directories (it does not)
- Not knowing /home is where user data lives
Best Answer (HR Friendly)
“Linux keeps all files under one main folder called root, and each standard sub-folder has a clear job. Programs live in /bin, settings live in /etc, and changing data like logs lives in /var, so everyone knows where to look.”
Code Example
ls /bin # essential command binaries (ls, cp, cat)
ls /etc # system and service configuration files
ls /var/log # log files that grow over time
cat /etc/os-release # a typical config file in /etc
df -h / # everything mounts under the single root treeFollow-up Questions
- What is the difference between /bin and /usr/bin?
- Why are /sbin binaries separated from /bin?
- What kind of data belongs in /var versus /tmp?
- What is the Filesystem Hierarchy Standard?
- Where would you look to debug a failing service's logs?
MCQ Practice
1. Which directory holds host-specific configuration files?
/etc is the standard location for host-specific, editable configuration files.
2. Where do log files typically live?
/var holds variable runtime data, and logs are stored under /var/log.
3. What sits at the very top of the Linux filesystem?
The single root directory / is the top of the entire unified tree; /root is only the root user's home.
Flash Cards
What is /bin for? — Essential user command binaries such as ls, cp, and cat, available even in single-user mode.
What is /etc for? — Host-specific, human-readable configuration files for the system and installed services.
What is /var for? — Variable data that changes at runtime: logs, mail queues, print spools, and caches.
Does Linux use drive letters? — No. Everything lives under a single root (/), and devices are mounted into that tree.