Linux uses a hierarchical file system structure where everything begins at the root directory (/
) and branches out into various subdirectories. Unlike operating systems like Windows, Linux does not use drive letters (e.g., C:); instead, all storage devices are mounted under the root directory.
Key Components of the Linux File System
-
Root Directory (
/
):-
SimilThe top-level directory from which all other directories branch out.
-
-
/bin
:-
Contains essential binary executables, such as common command-line tools (e.g.,
ls
,cp
,mv
). -
Available for all users.
-
-
/boot
:-
Stores files needed for the system boot process, including the Linux kernel and bootloader files.
-
-
/dev
:-
Contains device files representing hardware components like hard drives, USB devices, and printers.
-
-
/etc
:-
Holds system-wide configuration files and scripts (e.g., network configurations, user credentials).
-
Examples:
/etc/passwd
,/etc/fstab
.
-
-
/home
:-
Contains personal directories for all users (e.g.,
/home/username
). -
Each user’s directory stores their documents, downloads, and personal configuration files.
-
-
/lib
:-
Houses shared libraries required by binaries in
/bin
and/sbin
.
-
-
/media
:-
Used for automatically mounting removable media like CDs, DVDs, and USB drives.
-
-
/mnt
:-
A generic mount point for temporary mounting of file systems (e.g., network drives).
-
-
/opt
:-
Contains optional software and add-on packages.
-
-
/proc
:-
A virtual file system providing information about running processes and the kernel.
-
Example:
/proc/cpuinfo
shows CPU details.
-
-
/root
:-
The home directory for the root (superuser) account.
-
-
/sbin
:-
Stores essential system binaries, typically used by the system administrator (e.g.,
fsck
,reboot
).
-
-
/tmp
:-
A temporary directory for files generated by running processes.
-
Files in
/tmp
are usually cleared on reboot.
-
-
/usr
:-
Contains user-installed software and utilities.
-
Subdirectories include
/usr/bin
,/usr/lib
, and/usr/share
.
-
-
/var
:-
Stores variable files such as logs, caches, and spool files (e.g.,
/var/log
,/var/spool
).
-