Filesystem Layout
Understanding the UNIX/Linux file system layout is crucial for navigating, managing and troubleshooting your system.
Even if you only interact with a few directories at first, knowing the structure gives context to commands like ls, cd and nano.
The Root Directory /
Everything in Unix starts at the root directory, /. All other directories branch from here.
Key directories:
| directory | purpose |
|---|---|
/bin | Essential command binaries (e.g., ls, cat, echo) |
/sbin | System binaries, usually for administrative tasks (e.g., ifconfig, mount) |
/etc | Configuration files for the system and applications |
/home | User home directories (e.g. /home/user, /home/alice, /home/bob) |
/root | Root user’s home directory |
/var | Variable files: logs, databses, mail spools |
/tmp | Temporary files, cleared on reboot or periodically |
/usr | In unix, refers to “user” however now it refers to “Unix System Resources/Repository”. Contains user utilities and applications |
/lib | Shared libraries for programs in /bin and /sbin |
/dev | Device files representing hardware and virtual devices |
/proc | Virtual filesystem providing process and kernel information |
/sys | Kernel and system information |
Home Directories
Each user has a home directory under /home. For example,
user@machine:~$ ls /home
user alice bobYour home directory contains personal files, configurations and subdirectories like Documents, Downloads and Desktop. On minimal installs, such as arch linux or WSL, your home directory may be empty.
File system navigation tips
| command | description |
|---|---|
cd / | Go to root |
cd ~ | Go to your home directory |
cd .. | Go up on directory |
cd - | Return to previous directory |
You can combine these with relative paths. For example:
user@machine:/$ cd ~/Documents/Projects
user@machine:~/Documents/Projects$Mount Points and External Devices
Unix/Linux uses a single tree structure. External storage is “mounted” into directories under /mnt or /media.
user@machine:/$ ls /mnt
usb sdcardYou can access these devices like normal directories once mounted.
Virtual Filesystems
/proc -> contains information about running processes.
user@machine:/$ ls /proc/sys -> contains system and kernel information.
These are not real files but provide interfaces to the kernel and processes.
Summary
/ is the root of everything.
/home contains users’ personal directories.
/bin, /sbin, /lib, /usr contain commands, libraries, and system software.
/etc contains configuration files.
/proc and /sys provide dynamic system information.
/mnt and /media are used for mounted devices.
Learning this structure early will save you time and frustration when navigating, troubleshooting, and writing scripts.