Linux System Directory Structure

Linux System Directory Structure

Linux can actually change the rules, but most still follow this structure.http://www.pathname.com/fhs/

$> man hier  //description of the file system hierarchy#> tree -d -L 2 /  

/: This is the root directory. This is where the whole tree starts.

/bin: This directory contains executable programs which are needed in single user mode and to bring the system up or repair it.

bin is short for Binary, and this directory stores the most frequently used commands.

/boot: This directory contains executable programs which are needed in single user mode and to bring the system up or repair it.

This directory stores some core files used to boot Linux, including some linking files and image files.

/dev : Special or device files, which refer to physical devices. See mknod(1).

dev is short for Device, and this directory contains external devices of Linux. In Linux, accessing devices is the same as accessing files.

/etc: This directory is used to store all configuration files and subdirectories needed for system management.

/usr: This is a very important directory where many user applications and files are stored, similar to the program files directory in Windows.

/usr/bin:

Applications used by system users.

/usr/sbin:

Advanced management programs and system daemons used by the superuser.

/usr/src:

The default directory for kernel source code.

/home: On machines with home directories for users, these are usually beneath this directory, directly or not. The structure of this directory depends on local administration decisions.

User’s home directory; in Linux, each user has their own directory, usually named after their account.

/lib: This directory contains the basic dynamic linking shared libraries of the system, similar to DLL files in Windows. Almost all applications need these shared libraries.

/lost+found: This directory is usually empty; it stores some files after an illegal system shutdown.

/media: The Linux system automatically recognizes some devices, such as USB drives and CD-ROMs. When recognized, Linux mounts the devices under this directory.

/mnt: This directory is provided by the system for users to temporarily mount other file systems. We can mount a CD-ROM at /mnt/ and then enter that directory to view the contents of the CD-ROM.

/opt: This is the directory for additional software installations on the host. For example, if you install an ORACLE database, it can be placed in this directory. It is empty by default.

/proc: This directory is a virtual directory that maps to the system memory. We can access this directory directly to obtain system information.

/* The contents of this directory are not on the hard disk but in memory, // * We can also directly modify some files inside, * For example, we can use the command below to block the host's ping command, preventing others from pinging your machine */#> For example, we can use the command below to block the host's ping command, preventing others from pinging your machine

/root:

This directory is the home directory of the system administrator, also known as the superuser.

/sbin:

s stands for Super User, and this directory contains system management programs used by the system administrator.

/selinux:

This directory is specific to Redhat/CentOS. Selinux is a security mechanism similar to the Windows firewall, but this mechanism is more complex. This directory stores files related to selinux.

/srv:

This directory stores data needed after some services are started.

/sys:

This is a significant change in the Linux 2.6 kernel. This directory contains a new file system called sysfs introduced in the 2.6 kernel.

The sysfs file system integrates information from the following three file systems: the proc file system for process information, the devfs file system for devices, and the devpts file system for pseudo-terminals.

This file system is an intuitive reflection of the kernel device tree.

When a kernel object is created, the corresponding files and directories are also created in the kernel object subsystem.

/tmp:

This directory is used to store temporary files.

/var:

This directory contains items that are constantly growing. We usually place directories that are frequently modified in this directory, including various log files.

/run:

This is a temporary file system that stores information since the system was started. When the system restarts, the files in this directory should be deleted or cleared. If your system has a /var/run directory, it should point to run.

This article is a summary based on my self-study experience. If you have any suggestions or opinions, please leave a comment at the end of the article. Thank you.

Leave a Comment