Unlike Windows, which uses drive letters (like C: and D:), Linux employs a single, hierarchical
tree structure that starts with the root directory, represented by a single forward slash /.
Everything else branches off from this root.
/ (Root): This is the top-level directory, the very beginning of the entire file system. All
other files and directories are organized under it. You can think of it as the trunk of a
tree.
/bin (Binaries): This directory contains essential user commands, the basic utilities you
need to run the system and perform common tasks. These are typically compiled
executable programs. Examples include ls, cp, mv, rm, mkdir, and cat. These binaries are
intended for use by all users.
/boot (Boot Files): This directory holds the files required to boot your Linux system. This
includes the kernel (the core of the operating system), initial RAM disk images (initrd or
initramfs), and bootloader configuration files (like GRUB or LILO).
/dev (Devices): Linux treats hardware devices as files. This directory contains special
device files that represent both physical and virtual devices connected to the system.
Examples include /dev/sda (the first SATA hard drive), /dev/tty (terminal devices), and
/dev/random (a source of random numbers).
/etc (Et Cetera/Configuration): This directory is where system-wide configuration files
and scripts are stored. These files control the behavior of the operating system and
various applications. Examples include network configuration files, user account
information (/etc/passwd, /etc/shadow), system startup scripts, and configuration files
for installed software.
/home: This is the home directory for regular users. Each user on the system typically
has their own subdirectory within /home (e.g., /home/user1, /home/john). This is where
users store their personal files, documents, downloads, and application-specific
configuration files.
/lib (Libraries): This directory contains essential shared libraries (similar to DLLs in
Windows) needed by the executables in /bin and /sbin. These libraries contain code that
multiple programs can use. You'll also find kernel modules (device drivers) often located
in subdirectories of /lib.
/media: This directory serves as a mount point for removable media, such as USB drives,
CDs, and DVDs, when they are temporarily attached to the system. When you plug in a
USB drive, a subdirectory will often be created under /media where you can access its
contents.
/mnt (Mount): This is another directory used for mounting file systems, but it's
traditionally used for more permanent mounts of other partitions or network file
systems (though /media is preferred for removable media).
/opt (Optional): This directory is typically used for installing optional or third-party
software packages that are not part of the standard distribution's repositories. Software
installed in /opt usually resides in its own subdirectory within /opt.
/proc (Processes): This is a virtual file system that doesn't actually store any files on disk.
Instead, it provides a dynamic, hierarchical view of the running processes and kernel
information. You can access information about each process, system resources, and
hardware configuration through files in /proc.
/root: This is the home directory for the root user (the system administrator). It's kept
separate from other user home directories for security reasons.
/run: This is a relatively new directory that provides a temporary filesystem for runtime
data. It's used for things like process IDs (PID files), sockets, and other transient data that
needs to persist across reboots.
/sbin (System Binaries): Similar to /bin, this directory contains essential system
administration commands and utilities. These are typically used by the root user for
system maintenance and configuration. Examples include fdisk, mkfs, ifconfig, and
shutdown.
/srv (Service Data): This directory is intended to contain data served by the system, such
as website files for a web server or FTP files for an FTP server.
/sys (System): Similar to /proc, this is a virtual file system that provides a structured view
of the kernel's objects, devices, and drivers. It's a more modern and organized way to
access kernel information compared to /proc in some aspects.
/tmp (Temporary): This directory is used for temporary files created by applications and
the system. The contents of /tmp are usually cleared upon system reboot or periodically.
/usr (Unix System Resources): This is a major directory hierarchy that contains the
majority of user-related programs and data. It's often read-only for normal users. Key
subdirectories within /usr include:
o /usr/bin: Non-essential user commands (compared to /bin).
o /usr/lib: Libraries for the programs in /usr/bin and /usr/sbin.
o /usr/local: A separate hierarchy for locally installed software. It often mirrors the
structure of /usr (e.g., /usr/local/bin, /usr/local/lib).
o /usr/sbin: Non-essential system administration commands.
o /usr/share: Architecture-independent data files, such as documentation, man
pages, fonts, and icons.
o /usr/src: Source code for the kernel and other software (often optional).
/var (Variable): This directory contains variable data that changes during the normal
operation of the system. This includes:
o /var/log: System log files.
o /var/spool: Spool directories for tasks like printing and email.
o /var/tmp: Temporary files that are preserved across reboots (unlike /tmp).
o /var/www: Often used as the default location for website files (depending on the
web server configuration).
Understanding this directory structure is fundamental to navigating and managing a Linux
system effectively.
Directory Purpose
/ Root of the filesystem. Everything starts here.
/bin Essential user command binaries (e.g., ls, cp, mv). Needed in single-user
mode.
/sbin System binaries used by the root user (e.g., fsck, reboot).
/boot Bootloader files (e.g., vmlinuz, initrd). Needed to boot the system.
/dev Special device files (e.g., /dev/sda, /dev/null).
/etc Host-specific configuration files (e.g., /etc/fstab, /etc/passwd).
/home User home directories (e.g., /home/alice).
/root Home directory for the root user.
/lib Shared libraries for binaries in /bin and /sbin.
/media Mount point for removable media (USB, CD-ROM).
/mnt Temporary mount point (for manual mounting).
/opt Optional add-on packages (e.g., custom apps).
/proc Virtual filesystem showing kernel info (e.g., /proc/cpuinfo).
/run Runtime system info (e.g., PID files, services).
/srv Data for services like web, FTP, or databases.
/sys Virtual filesystem giving system and device info (used by udev).
/tmp Temporary files (cleared at boot by default).
/usr User-level programs, libraries, and documentation.
/var Variable data (e.g., logs in /var/log, mail, print spool).