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 each top‑level directory such as /bin, /sbin, /etc, /dev, /proc, /usr, /var, /home, and how they relate to system boot, configuration, and daily operation.
Linux directory structure and purpose:
/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: Standard libraries (shared objects), similar to Windows .dll files.
/sbin: System administration commands for privileged users.
/tmp: Temporary files used by programs.
/root: Home directory of the system administrator.
/mnt: Temporary mount point for other filesystems.
/lost+found: Holds orphaned files after an abnormal shutdown.
/proc: Virtual directory providing a view of system memory and information.
/var: Variable data such as logs, spools, and temporary files.
/usr: Largest directory containing most applications and files, including:
/usr/x11r6: X Window system files.
/usr/bin: General applications.
/usr/sbin: Superuser management programs.
/usr/doc: Linux documentation.
/usr/include: Header files for development.
/usr/lib: Shared libraries and package configuration.
/usr/man: Manual pages.
/usr/src: Source code (e.g., kernel source).
/usr/local/bin: Locally added commands.
/usr/local/lib: Locally added libraries.
The root filesystem should remain small, containing only essential files needed for boot and recovery; most other files reside in subdirectories.
1. /bin directory
/bin contains essential binary commands required for system boot and for regular users.
2. /sbin directory
/sbin stores binary files mainly used by system administrators; regular users can execute them only when permitted.
3. /etc directory
/etc holds various system configuration files, including user information (/etc/passwd) and initialization scripts (/etc/rc).
4. /root directory
/root is the superuser's home directory.
5. /lib directory
/lib contains shared libraries required by programs in the root filesystem, reducing duplication and saving space.
6. /lib/modules directory
/lib/modules stores loadable kernel modules, especially those needed for system recovery.
7. /dev directory
/dev contains device files that provide access to hardware (e.g., /dev/mouse).
8. /tmp directory
/tmp holds temporary data generated by programs; after boot, /var/tmp is preferred for larger temporary storage.
9. /boot directory
/boot stores bootloader files and kernel images; large numbers of kernels may warrant a separate filesystem.
10. /mnt directory
/mnt is a temporary mount point for attaching other filesystems.
11. /proc, /usr, /var, /home directories
These directories serve as major filesystem partitions, each with distinct purposes: /usr for static applications, /var for variable data, /home for user data, and /proc as a virtual interface to kernel information.
/etc filesystem
/etc includes many configuration files such as /etc/rc.d (startup scripts), /etc/passwd (user database), /etc/fstab (filesystem table), /etc/group, /etc/inittab, /etc/issue, /etc/magic, /etc/motd, /etc/mtab, /etc/shadow, /etc/login.defs, /etc/printcap, /etc/profile, /etc/securetty, /etc/shells, and /etc/termcap.
/dev filesystem
/dev provides device files like /dev/console, /dev/hd, /dev/sd, /dev/fd, /dev/st, /dev/tty, /dev/pty, /dev/ttys, /dev/cua, and /dev/null.
/usr filesystem
/usr contains most installed software and documentation, including subdirectories such as /usr/x11r6, /usr/x386, /usr/bin, /usr/sbin, /usr/man, /usr/info, /usr/doc, /usr/include, /usr/lib, and /usr/local.
/var filesystem
/var holds data that changes during system operation, including /var/catman, /var/lib, /var/local, /var/lock, /var/log, /var/run, /var/spool, and /var/tmp.
/proc filesystem
/proc is a virtual filesystem providing kernel and process information, with entries such as /proc/x, /proc/cpuinfo, /proc/devices, /proc/dma, /proc/filesystems, /proc/interrupts, /proc/ioports, /proc/kcore, /proc/kmsg, /proc/ksyms, /proc/loadavg, /proc/meminfo, /proc/modules, /proc/net, /proc/self, /proc/stat, /proc/uptime, and /proc/version.
/usr/local is typically used for manually installed software, mirroring the structure of /usr, while /opt is reserved for large third‑party applications.
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
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.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
