Understanding the Linux File System
Introduction
The Linux file system is the backbone of how Linux organizes and stores data. Unlike Windows which uses drive letters like C: and D:, Linux organizes everything into a single unified tree starting from one root directory. Understanding this structure will help you navigate, configure, and manage any Linux system confidently.
The Root Directory
Everything in Linux starts at the root directory, represented by a single forward slash.
/
Every file and folder on the system lives somewhere under this root, including external drives, network shares, and system devices.
Key Directories Explained
/bin — Essential User Binaries
Contains fundamental command-line programs that are available to all users, such as ls, cp, mv, rm, and cat. These are the core tools needed to use the system.
/sbin — System Binaries
Similar to /bin but contains commands intended for system administration, such as fdisk, ifconfig, and reboot. These typically require root privileges to run.
/etc — Configuration Files
This is one of the most important directories. It stores system-wide configuration files for almost every installed application and service. For example, /etc/nginx/nginx.conf configures Nginx, and /etc/hosts maps hostnames to IP addresses.
/home — User Home Directories
Each user on the system gets their own folder inside /home. For example, a user called alice would have their personal files, settings, and documents stored at /home/alice. The tilde symbol ~ is a shortcut for your own home directory.
/root — Root User's Home
The home directory for the root (superuser) account. It is separate from /home for security reasons.
/var — Variable Data
Stores files that change frequently during normal system operation. This includes log files in /var/log, mail spools, and database files. If you are debugging a service, /var/log is the first place to look.
/tmp — Temporary Files
A scratch space for temporary files created by applications. Files here are usually cleared on reboot and should never be used for permanent storage.
/usr — User Programs
Contains the majority of installed software and libraries. Key subdirectories include /usr/bin for user commands, /usr/lib for libraries, and /usr/share for shared data like documentation.
/opt — Optional Software
Used for software installed manually or from third-party sources outside the package manager, such as commercial applications or custom tools.
/dev — Device Files
In Linux, hardware devices are represented as files. /dev/sda is typically your primary hard drive, /dev/null discards anything written to it, and /dev/random generates random data. This design lets programs interact with hardware using the same tools used for files.
/proc — Process Information
A virtual filesystem that exposes real-time information about running processes and the kernel. For example, /proc/cpuinfo shows CPU details and /proc/meminfo shows memory usage. Nothing here is stored on disk.
/sys — System and Kernel Information
Similar to /proc, this virtual filesystem exposes information about hardware devices and kernel features. It is used by the kernel and system tools to communicate.
/mnt and /media — Mount Points
External storage devices like USB drives and CD-ROMs are mounted here. /media is typically used by the system automatically, while /mnt is used for manual mounts.
/lib — Shared Libraries
Contains shared library files needed by programs in /bin and /sbin to run, similar to DLL files on Windows.
Absolute vs Relative Paths
An absolute path starts from root and gives the full location of a file.
/home/alice/documents/report.txt
A relative path starts from your current directory. If you are already in /home/alice, the relative path to the same file would be the following.
documents/report.txt
File Permissions
Every file in Linux has an owner and a set of permissions controlling who can read, write, or execute it. Running ls -l shows these permissions.
-rwxr-xr-- 1 alice staff 4096 Jan 01 12:00 script.sh
The permission string breaks down as follows. The first character is the file type. The next three characters are the owner's permissions. The following three are the group's permissions. The final three are permissions for everyone else.
Conclusion
The Linux file system follows a logical and consistent structure that makes it powerful once understood. Knowing where configuration lives, where logs are stored, and how paths work will make you significantly more effective on any Linux system.