π§ Ultimate Guide to Linux Directories & Files

Table of contents
- π What Is the Linux File System?
- π² The File System Tree Overview
- π§° In-Depth Directory Breakdown
- π¦ /bin β Essential User Commands
- βοΈ /sbin β System Binaries
- π§ /boot β Boot Loader Files
- π§ͺ /dev β Device Files
- π /etc β Configuration Files
- π /home β User Home Directories
- π /root β Root Userβs Home
- 𧬠/lib and /lib64 β Shared Libraries
- π /media and /mnt β Mount Points
- πΌ /opt β Optional Software Packages
- π§Ύ /proc β Process Info (Virtual Filesystem)
- π /run β Runtime Data
- ποΈ /srv β Service Data
- β οΈ /tmp β Temporary Files
- π /usr β User System Resources (Not βHomeβ Users)
- π /var β Variable Files
- π§© Which Directories Are Symlinks?

If youβre stepping into the world of Linux, understanding its file system hierarchy is crucial. Think of it like learning your way around a cityβonce you know where everything is, using it becomes second nature. This guide will take you from the basics to expert-level knowledge about Linux directories, their roles, important files, and even symbolic links (shortcuts).
π What Is the Linux File System?
The Linux file system is the structure where data is stored, organized, and accessed. Unlike Windows (which uses drive letters like C:, D:), Linux uses a tree-like structure starting at a single root directory: /
.
π§Ύ Basic Terms to Know:
Directory: A folder used to group files.
File: A data container (text, binary, config, etc.)
Root (
/
): The topmost directory in the hierarchy.Symlink (Symbolic Link): A shortcut or reference to another file/directory.
π² The File System Tree Overview
Everything starts from /
(root). All files and folders branch out from here.
/
βββ bin
βββ boot
βββ dev
βββ etc
βββ home
βββ lib -> usr/lib
βββ lib64 -> usr/lib64
βββ media
βββ mnt
βββ opt
βββ proc
βββ root
βββ run
βββ sbin -> usr/sbin
βββ srv
βββ sys
βββ tmp
βββ usr
βββ var
π Notice: Some directories like /lib
, /sbin
, and /bin
are now symlinks pointing to /usr/lib
, /usr/sbin
, and /usr/bin
on modern Linux systems.
π§° In-Depth Directory Breakdown
Letβs explore each directory in detail with examples, real-world use, and shortcut (symlink) info.
π¦ /bin
β Essential User Commands
Purpose: Contains basic executable programs and command-line tools required by all users.
Examples:
ls
,cp
,mv
,rm
,cat
Access: Available to all users.
Important: Needed during system recovery.
π On newer distros, /bin
is a symlink to /usr/bin
.
βοΈ /sbin
β System Binaries
Purpose: Holds system-level utilities mainly used by the root (admin) user.
Examples:
fsck
,reboot
,shutdown
,ifconfig
Access: Restricted to root for system maintenance.
π Typically symlinked to /usr/sbin
.
π§ /boot
β Boot Loader Files
Purpose: Contains all files required to boot the system.
Includes: Kernel files (vmlinuz), initrd, grub config files.
Caution: Messing with this can break your system!
π Example files:
/boot/grub/grub.cfg
/boot/vmlinuz-5.15.0
π§ͺ /dev
β Device Files
Purpose: Represents system devices as files.
Type: Virtual, dynamically managed by the kernel (udev).
Examples:
/dev/sda
β Hard disk/dev/tty
β Terminals/dev/null
β βBlack holeβ file
π§ Why? Because in Linux, everything is a fileβincluding hardware.
π /etc
β Configuration Files
Purpose: Houses all system-wide configuration files and directories.
DO NOT store personal data here.
Examples:
/etc/passwd
: List of system users/etc/ssh/sshd_config
: SSH settings/etc/fstab
: Filesystem mount table
π§ Most services (like networking, cron jobs, etc.) read their settings from /etc
.
π /home
β User Home Directories
Purpose: Personal directories for every user (non-root).
Layout:
/home/username/
Whatβs Inside: Documents, Pictures, Downloads, personal app settings
π‘ Each user can modify files in their own home but not in othersβ or system directories.
π /root
β Root Userβs Home
Purpose: Home directory of the superuser.
Not to be confused with / (root of the file system).
Path:
/root/
(not under /home!)
π Only accessible by the root user.
𧬠/lib
and /lib64
β Shared Libraries
Purpose: Contains essential shared libraries needed by binaries in /bin and /sbin.
64-bit Systems: Use
/lib64
for 64-bit libraries.
π These are often symbolic links to /usr/lib
and /usr/lib64
.
π /media
and /mnt
β Mount Points
/media
: Auto-mounted external devices (USBs, DVDs)/mnt
: Temporary mount point for system admin (manual)
π§ Mounting means linking a device to the file system so it becomes accessible.
πΌ /opt
β Optional Software Packages
Purpose: For third-party software that doesnβt fit into standard paths.
Example: Google Chrome or proprietary software installations.
ποΈ Often used for large software suites.
π§Ύ /proc
β Process Info (Virtual Filesystem)
Purpose: Dynamic, virtual files showing system and process info.
Managed by: Kernel
Examples:
/proc/cpuinfo
: CPU details/proc/meminfo
: Memory usage/proc/[PID]/
: Info about a specific process
π§ These files donβt exist on diskβtheyβre created in real time!
π /run
β Runtime Data
Purpose: Stores volatile runtime info (like PID files) needed between boot and services.
Cleared at: Every reboot.
Used by: systemd, network services, login sessions
ποΈ /srv
β Service Data
Purpose: Contains data for services like FTP, HTTP, etc.
Examples:
/srv/ftp/
/srv/www/
π¨βπ» Useful for servers hosting public services.
β οΈ /tmp
β Temporary Files
Purpose: Temp files created by applications.
Auto-cleared: On reboot or scheduled cleanup.
Examples:
Download caches
Unzipped install files
π§Ό Never store important data here!
π /usr
β User System Resources (Not βHomeβ Users)
Purpose: Contains application binaries, libraries, docs not critical to boot.
Structure:
/usr/bin
: User-level commands/usr/lib
: Libraries/usr/share
: Shared documentation, icons
π‘ On modern distros, this is the core of most Linux software.
π /var
β Variable Files
Purpose: Data that changes frequently.
Includes:
Logs (
/var/log
)Mail spools
Print queues
Databases
π If your system runs out of space, /var
is often the culprit.
π§© Which Directories Are Symlinks?
Here are the most common symlinked directories:
Directory | Symlink To | Purpose |
/bin | /usr/bin | Basic commands |
/sbin | /usr/sbin | System commands |
/lib | /usr/lib | Shared libraries |
/lib64 | /usr/lib64 | 64-bit libraries |
These symlinks ensure backward compatibility and maintain a cleaner structure under /usr.
π Key System Files to Know
File | Description |
/etc/passwd | User account details |
/etc/shadow | Encrypted user passwords |
/etc/fstab | Auto-mount drives |
/etc/hostname | System hostname |
/etc/hosts | Local DNS mappings |
/var/log/syslog | System logs |
/proc/cpuinfo | CPU info |
/etc/resolv.conf | DNS resolver settings |
π§ Why Learning the Linux File System Matters
Mastering the file system allows you to:
β Troubleshoot faster
β Understand where apps store data
β Secure your system better
β Automate tasks using the terminal
β Feel confident working with Linux πͺ
Subscribe to my newsletter
Read articles from Jitendra Kumar directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by
