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:

directorypurpose
/binEssential command binaries (e.g., ls, cat, echo)
/sbinSystem binaries, usually for administrative tasks (e.g., ifconfig, mount)
/etcConfiguration files for the system and applications
/homeUser home directories (e.g. /home/user, /home/alice, /home/bob)
/rootRoot user’s home directory
/varVariable files: logs, databses, mail spools
/tmpTemporary files, cleared on reboot or periodically
/usrIn unix, refers to “user” however now it refers to “Unix System Resources/Repository”. Contains user utilities and applications
/libShared libraries for programs in /bin and /sbin
/devDevice files representing hardware and virtual devices
/procVirtual filesystem providing process and kernel information
/sysKernel and system information

Home Directories

Each user has a home directory under /home. For example,

shellsession
user@machine:~$ ls /home
user  alice  bob

Your 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

commanddescription
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:

shellsession
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.

shellsession
user@machine:/$ ls /mnt
usb  sdcard

You can access these devices like normal directories once mounted.

Virtual Filesystems

/proc -> contains information about running processes.

shellsession
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.