Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

Linux System Directory Structure

Linux System Directory Structure

After logging in to the system, enter the following command in the current command window:

 ls / 

You will see something like the following:

Tree-like directory structure:

The following is an explanation of these directories:

directory Detailed Functions Common Files / Examples
/ The root filesystem, the starting point of all mount points and paths. Contains the subdirectories and entry structures required by the system. No specific data files, only subdirectory structures.
/bin Essential commands required for system boot and single-user mode, executable by all users. ls, cp, mv, rm, bash
/sbin System administration and maintenance commands, intended for root. fsck, reboot, shutdown
/usr The main collection of user-level programs and libraries, containing most system software, documentation, and tools. /usr/bin, /usr/lib, /usr/share
/usr/bin The main directory for regular user programs. python3, vim, git
/usr/sbin An extended collection of administration tools. useradd, apache2ctl
/usr/lib /usr Dynamic libraries and modules needed by programs. Various .so dynamic libraries
/usr/local A separate area for software installed or compiled locally. /usr/local/bin, /usr/local/lib
/lib or /lib64 Location of core system boot libraries and the dynamic linker. libc.so.6, ld-linux.so
/etc The system-level configuration center, where all service and system configurations are stored. passwd, group, fstab, ssh/sshd_config
/home Collection of personal home directories for regular users. /home/user/.bashrc, /home/user/Documents
/root The home directory of the root user. /root/.ssh/
/var Frequently changing data: logs, caches, database runtime files, etc. /var/log, /var/lib, /var/cache
/var/log Central location for all system and service logs. syslog, auth.log, kern.log
/var/cache Caches for applications and the package manager. /var/cache/apt/
/var/lib Persistent state data of services. mysql/, docker/
/tmp Temporary file area for running programs, can be cleaned at any time. Temporary files, socket paths
/boot Files needed for booting: kernel, initramfs, bootloader configuration. vmlinuz-*, initrd.img, grub/grub.cfg
/dev Collection of device nodes, where files are devices. /dev/sda, /dev/null, /dev/tty0
/proc A virtual filesystem provided by the kernel that displays real-time information about the system and processes. /proc/cpuinfo, /proc//
/sys Status interfaces for devices, drivers, and kernel subsystems. /sys/class/net/, /sys/block/
/mnt Temporary mount points for manual mounts. /mnt/usb
/media Default location for automatically mounting external devices. /media/user/USB_DRIVE
/run Storage for runtime data, cleared after reboot. *.pid, runtime state socket files

In Linux, the following directories are critical system areas; deleting or modifying them incorrectly will directly break the system:

/etc - Core system configuration

All critical configuration is centralized here. Any incorrect modification may cause services to fail or even prevent the system from booting.

/bin, /sbin, /usr/bin, /usr/sbin - System command areas

Location of the system's preset commands.

/var - Dynamic data area

Data continuously written while the system runs is stored here.
The key part is /var/log, where all kinds of service logs are stored; mail, caches, queues, and other content are also maintained in this directory.