Fundamentals 21 min read

Understanding Linux Directory Structure: A Complete Guide to /bin, /etc, /usr, and More

This article provides a comprehensive overview of the Linux filesystem hierarchy, explaining the purpose and typical contents of key directories such as /bin, /sbin, /etc, /dev, /proc, /usr, /var, /home, and others, helping readers grasp essential system organization.

MaGe Linux Operations
MaGe Linux Operations
MaGe Linux Operations
Understanding Linux Directory Structure: A Complete Guide to /bin, /etc, /usr, and More

Linux Directory Structure Overview

The Linux filesystem is organized into several top‑level directories, each serving a specific purpose. Below is a concise description of the most important ones.

/bin: binary executable commands.

/dev: device special files.

/etc: system management and configuration files.

/etc/rc.d: startup configuration files and scripts.

/home: user home directories (e.g., /home/user).

/lib: shared libraries (similar to Windows .dll files).

/sbin: system administration commands.

/tmp: temporary files used by programs.

/root: root (superuser) home directory.

/mnt: temporary mount point for other filesystems.

/lost+found: holds orphaned files after an abnormal shutdown.

/proc: virtual directory exposing kernel and system information.

/var: variable data such as logs and spools.

/usr: largest hierarchy containing most applications and files, with subdirectories like /usr/bin, /usr/sbin, /usr/lib, /usr/include, /usr/share, /usr/local, etc.

Typically the root filesystem should remain small because most files rarely change; only essential boot files (e.g., /vmlinuz) reside there. All other files are placed in subdirectories.

1. /bin Directory

/bin contains essential binary commands required for system boot and for regular users after boot.

2. /sbin Directory

/sbin is similar to /bin but primarily holds binaries used by system administrators; regular users may execute them when permitted.

3. /etc Directory

/etc stores various system configuration files, including user information (/etc/passwd), initialization scripts (/etc/rc), and many network configuration files.

4. /root Directory

/root is the home directory of the superuser.

5. /lib Directory

/lib holds shared libraries required by programs in the root filesystem, reducing duplication and saving space.

6. /lib/modules Directory

/lib/modules contains loadable kernel modules needed for hardware drivers and other core functionality.

7. /dev Directory

/dev contains device files that provide access to hardware devices (e.g., /dev/mouse, /dev/console).

8. /tmp Directory

/tmp stores temporary data generated by programs at runtime; after boot, /var/tmp is often preferred for larger temporary files.

9. /boot Directory

/boot holds bootloader files and kernel images. When many kernels are present, a separate filesystem may be used.

10. /mnt Directory

/mnt serves as a temporary mount point for manually mounting other filesystems (e.g., /mnt/cdrom, /mnt/ext2).

11. /proc, /usr, /var, /home Directories

These directories host additional filesystems: /proc is a virtual filesystem exposing kernel data; /usr contains read‑only application files; /var holds variable data; /home stores user data.

Each machine has a root filesystem containing boot files and tools needed for single‑user mode, system repair, and backup restoration.

/etc File System Details

/etc includes many important configuration files:

/etc/rc or /etc/rc.d or /etc/rc?.d – startup scripts.

/etc/passwd – user database.

/etc/fdprm – floppy parameters.

/etc/fstab – filesystems to mount at boot.

/etc/group – group information.

/etc/inittab – init configuration.

/etc/issue – pre‑login message.

/etc/magic – file command database.

/etc/motd – message of the day.

/etc/mtab – currently mounted filesystems.

/etc/shadow – shadow password file (more secure).

/etc/login.defs – login command configuration.

/etc/printcap – printer capabilities.

/etc/profile, /etc/csh.login, /etc/csh.cshrc – global shell environment.

/etc/securetty – list of terminals allowed for root login.

/etc/shells – list of valid login shells.

/etc/termcap – terminal capability database.

/dev File System Details

/dev provides device files for hardware access. Common entries include:

/dev/console – system console.

/dev/hd* – IDE hard‑disk partitions.

/dev/sd* – SCSI disk partitions.

/dev/fd0 – floppy drive.

/dev/st – SCSI tape drive.

/dev/tty* – virtual consoles.

/dev/pty* – pseudo‑terminals for remote login.

/dev/ttys – serial ports (e.g., COM1).

/dev/cua* – serial ports for modems.

/dev/null – null device (discards all data).

/usr File System Details

/usr is a large filesystem containing most user programs and data. Important subdirectories include:

/usr/x11r6 – X Window system binaries and files.

/usr/bin – most user commands.

/usr/sbin – system administration commands.

/usr/man, /usr/info, /usr/doc – manual pages and documentation.

/usr/include – C header files.

/usr/lib – shared libraries and package configuration.

/usr/local – locally installed software.

/var File System Details

/var stores data that changes frequently, such as logs, spools, and temporary files. Key subdirectories:

/var/catman – pre‑formatted manual pages.

/var/lib – variable state information.

/var/local – variable data for locally installed software.

/var/lock – lock files.

/var/log – system and application logs.

/var/run – runtime information (e.g., /var/run/utmp).

/var/spool – spool directories for mail, news, printers, etc.

/var/tmp – larger temporary files.

/proc File System Details

/proc is a pseudo‑filesystem exposing kernel and process information. Notable entries include:

/proc/[pid] – information about a specific process.

/proc/cpuinfo – CPU details.

/proc/devices – loaded device drivers.

/proc/dma – DMA channel usage.

/proc/filesystems – supported filesystems.

/proc/interrupts – interrupt usage.

/proc/ioports – I/O ports in use.

/proc/kcore – physical memory image.

/proc/kmsg – kernel messages.

/proc/loadavg – system load average.

/proc/meminfo – memory usage.

/proc/modules – loaded kernel modules.

/proc/net – network protocol status.

/proc/self – symbolic link to the calling process's /proc entry.

/proc/stat – various system statistics.

/proc/uptime – system uptime.

/proc/version – kernel version.

Additional directories such as /usr/local and /opt are used for manually installed software and large third‑party packages respectively.

Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

Directory Structure
MaGe Linux Operations
Written by

MaGe Linux Operations

Founded in 2009, MaGe Education is a top Chinese high‑end IT training brand. Its graduates earn 12K+ RMB salaries, and the school has trained tens of thousands of students. It offers high‑pay courses in Linux cloud operations, Python full‑stack, automation, data analysis, AI, and Go high‑concurrency architecture. Thanks to quality courses and a solid reputation, it has talent partnerships with numerous internet firms.

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.