Linux organizes its file system in a hierarchical structure, starting from the root directory (/
). Each directory serves a specific purpose, ensuring a clear and organized layout. Here’s an overview of the most important directories in the Linux file system:
Important Directories in Linux
/
(Root Directory)- The topmost directory in the Linux file system.
- All other directories and files stem from this directory.
- Accessible only by the root user for critical modifications.
/bin
(Binary Files)- Contains essential binary executables used by all users.
- Examples include common commands like
ls
,cat
,cp
,mv
, etc. - These binaries are available even in single-user mode (emergency mode).
/boot
(Boot Loader Files)- Stores files needed to boot the operating system, including:
- Kernel files (
vmlinuz
). - Boot loader configurations (e.g., GRUB files).
- Kernel files (
- Example:
/boot/grub/grub.cfg
.
/dev
(Device Files)- Contains device files representing hardware devices (e.g., disks, printers, terminals).
- Examples:
/dev/sda
: First hard drive./dev/tty
: Terminal devices./dev/null
: Null device for discarding output.
/etc
(Configuration Files)- Stores system-wide configuration files and scripts.
- Examples:
/etc/passwd
: User account details./etc/fstab
: Filesystem mount points./etc/hosts
: IP-to-hostname mappings.
/home
(User Home Directories)- Contains the personal directories for each user.
- Example:
/home/alice
: Home directory for the useralice
.
- Users store their personal files, configurations, and documents here.
/lib
(Shared Libraries)- Contains essential shared libraries required by programs in
/bin
and/sbin
. - Example:
/lib/libc.so.6
.
- Contains essential shared libraries required by programs in
/media
(Removable Media)- Mount point for removable media, such as USB drives, CDs, and DVDs.
- Example:
/media/usb
.
/mnt
(Temporary Mount Points)- Temporary mount point for filesystems during manual mounting.
- Commonly used for system administrators to mount disks temporarily.
/opt
(Optional Software)- Used to install third-party or optional software packages.
- Example:
/opt/vmware
for VMware-related files.
/proc
(Process Information)- Virtual filesystem providing information about running processes.
- Examples:
/proc/cpuinfo
: CPU details./proc/meminfo
: Memory usage./proc/[pid]
: Information about a specific process.
/root
(Root User's Home Directory)- Home directory for the
root
user (superuser). - Different from
/
(root directory).
- Home directory for the
/run
(Runtime Data)- Stores runtime data for system processes since boot time.
- Examples: Process IDs, sockets, and other transient files.
/sbin
(System Binaries)- Contains essential system binaries for administrative tasks.
- Examples:
ifconfig
: Network configuration.fsck
: Filesystem check.
/srv
(Service Data)- Stores data for services provided by the system (e.g., web servers, FTP).
- Example:
/srv/www
for web server data.
/sys
(System Information)- Virtual filesystem providing information about hardware devices and system settings.
- Example:
/sys/class/net
: Network interface details.
/tmp
(Temporary Files)- Temporary files created by users and applications.
- Automatically cleaned up after a reboot.
/usr
(User System Resources)- Contains user-level programs, libraries, and documentation.
- Subdirectories include:
/usr/bin
: User binaries./usr/lib
: Shared libraries./usr/share
: Shared resources (e.g., man pages)./usr/local
: Locally installed software.
/var
(Variable Files)- Contains files that change frequently during system operation.
- Examples:
/var/log
: Log files./var/spool
: Email and print jobs./var/tmp
: Temporary files.
Summary Table
Directory | Purpose |
---|---|
/ | Root directory, top of the hierarchy. |
/bin | Essential command binaries. |
/boot | Boot loader and kernel files. |
/dev | Device files for hardware. |
/etc | System-wide configuration files. |
/home | User home directories. |
/lib | Essential shared libraries. |
/media | Mount points for removable media. |
/mnt | Temporary mount points. |
/opt | Optional third-party software. |
/proc | Virtual filesystem for process info. |
/root | Home directory for the root user. |
/run | Runtime process data. |
/sbin | System administration binaries. |
/srv | Data for system services. |
/sys | Virtual filesystem for system info. |
/tmp | Temporary files. |
/usr | User binaries, libraries, and docs. |
/var | Variable data like logs and spools. |
Key Notes
- The Linux file system is modular, ensuring separation of concerns.
- Never modify critical directories (
/bin
,/lib
,/sbin
,/etc
) unless absolutely necessary. - Use
/tmp
for temporary data and/home
for user files.
Understanding these directories helps in navigating, configuring, and administering Linux systems effectively.
Comments
Post a Comment