Linux File System Hierarchy
Linux File System Hierarchy

Linux File System Hierarchy

The Linux file system hierarchy is structured in a tree-like format where all files and directories are rooted at a single directory known as the root directory (/). Here’s a detailed look at the Linux file system hierarchy and the purpose of each directory.


1. Root Directory(`/`)

- The starting point of the Linux file system hierarchy. All other directories and files are placed under this directory.


2. /bin(Binary)

- Contains essential binary executables (programs) needed for booting and system repair, such as ls, cp, mv, and bash.


3. /boot

- Holds files needed for booting the system, including the kernel, initial ramdisk, and bootloader configuration files (like GRUB).


4. /dev (Device Files)

- Contains device files that represent hardware components, such as disks (`/dev/sda`), partitions (`/dev/sda1`), and terminals (`/dev/tty`).


5. /etc(Configuration Files)

- Houses system-wide configuration files and shell scripts used for system administration, like /etc/fstab, /etc/passwd, and /etc/hostname.


6. /home

- User home directories are stored here. Each user has a directory named after their username (e.g., /home/user).


7. /lib(Libraries)

- Contains essential shared libraries needed by binaries in /bin and /sbin. For instance, libc.so.6 and ld-linux.so.2.


8. /media

- Temporary mount points for removable media like CDs, DVDs, and USB drives. Directories like /media/cdrom or /media/usb are common.


9. /mnt

- Temporary mount points for file systems, usually used by the system administrator for mounting storage devices or network shares temporarily.


10. /opt(Optional)

- Used for installing add-on application software packages. Typically, each package will have its own directory, such as /opt/vmware.


11. /proc (Process Information)

- A pseudo-filesystem that provides a mechanism to access kernel and process information. For example, /proc/cpuinfo provides information about the CPU.


12. /root

- The home directory of the root user (system administrator). This is different from /, which is the root of the file system hierarchy.


13. /run

- Stores transient files needed for system runtime, such as process IDs (`/run/sshd.pid`) and other temporary system information.


14. /sbin(System Binaries)

- Contains essential system binaries used for system administration tasks, like fdisk, fsck, ifconfig, and init.


15. /srv(Service Data)

- Contains data for services provided by the system. For example, web server data might be stored in /srv/www.


16. /sys(System Information)

- A virtual filesystem that provides information about the kernel, hardware, and other system components. It is similar to /proc but more structured.


17. /tmp(Temporary Files)

- Used for storing temporary files created by users or applications. Files in this directory are often deleted on system reboot.


18. /usr(User Binaries and Read-Only Data)

- Contains user utilities and applications. It has several subdirectories:

?- /usr/bin: Non-essential user command binaries (e.g., gcc, make).

?- /usr/sbin: Non-essential system binaries (e.g., httpd, sshd).

?- /usr/lib: Libraries for binaries in /usr/bin and /usr/sbin.

?- /usr/local: Locally installed software and libraries.

?- /usr/share: Architecture-independent data, such as documentation and icons.

?- /usr/include: Standard include files for development.


19. /var(Variable Data)

- Contains files to which the system writes data during operation, such as logs (`/var/log`), spool files (`/var/spool`), and temporary email files (`/var/mail`).


20. /swap(Swap Space)

- While not a directory, swap space is part of the disk used as virtual memory. It can be a partition or a file. Swap is used to supplement physical RAM by providing additional memory storage for inactive processes.


Summary

The Linux file system hierarchy is organized to separate system files from user files, configuration files from binaries, and transient files from persistent data. Understanding this hierarchy is essential for effective system administration and efficient file management.


File System Hierarchy


Happy Learning!


You can easy find your Admin. He controls all. You can help him with the same thing as you can help . Use TP link .

回复

要查看或添加评论,请登录

社区洞察

其他会员也浏览了