Linux directory structure detailed description

Source: Internet
Author: User
Tags documentation syslog system log

1. Tree-like directory structure diagram

This article mainly comes from the network to organize.
Directory Structure Reference address:


The root of the first hierarchy, the root of the entire file system hierarchy.
Required commands (executables) that are available in single-user mode, for all users, such as cat, LS, CP, and/usr/bin.
Bootstrapper files, for example: kernel, initrd; often a separate partition [6]
necessary equipment, for example:,/dev/null.
A system-wide configuration file for a specific host.
There is currently a controversy about this name. At Bell Labs in earlier versions of the UNIX implementation documentation,/etc is referred to as the/etcetra directory, [7] This is due to the fact that in the past this directory holds all things that are not elsewhere (however, FHS restricts/etc to store static configuration files and cannot contain binaries). [8] Since the early publication of the document, the catalog name has been re-styled in various ways. Recent explanations include reverse abbreviations such as "Editable text configuration" (English "Editable text config") or "Extended toolbox" (English "Extended tool Chest"). [9]
Configuration file for/opt/
Configuration file for X_window system (version 11)
Configuration files for SGML
Configuration file for XML
The user's home directory, which contains saved files, personal settings, etc., is generally a separate partition.
/bin/and/sbin/the necessary library files for binary files.
A mount point that removes media (such as CD-ROM), which appears in FHS-2.3.
In the Ext3 file system, when the system crashes unexpectedly or the machine shuts down unexpectedly, some file fragments are generated here. When the system is booting up, the fsck tool checks here and repairs the corrupted file system. When a problem occurs on the system. There may be files that are moved to this directory and may need to be repaired manually or moved to the original location of the file.
The file system that is temporarily mounted. such as Cdrom,u disk, directly into the optical drive can not be used, to be mounted after use
Optional application package.
A virtual file system that archives the kernel and process state as a text file (System information is stored in this directory). For example: uptime, network. In Linux, the corresponding PROCFS format is mounted. Files in this directory can only be viewed and cannot be changed (including root)
Home directory for super users
necessary system binaries, such as: Init, IP, mount. Sbin the command under the directory, ordinary users can not execute.
The specific data of the site, provided by the system.
Temporary files (see/VAR/TMP), files in the directory are not retained when the system restarts.
The default software will be stored in this directory. The second level for storing read-only user data, including most (many) user tools and applications.
Variable files--files whose contents are constantly changing in a functioning system, such as logs, Offline files, and temporary e-mail files. Sometimes it is a separate partition. If you do not partition separately, you may be able to fill the entire partition. If separate partition, give big to small not appropriate.
A specific host system-wide configuration file.

The directory of scripts or scripts that is running when the run level is started, or changed.
Local Domain name resolution file
IP, mask, Gateway, host name configuration
DNS server Configuration
Automatic mount system, all partitions will be automatically mounted on boot
Sets how the INIT process will set the system to runlevel and load the associated boot file configuration when the system starts
Setting the configuration file path for NFS systems
This directory to hold the system startup script
Global System Environment Configuration variables
Pre-authentication output information, default output version kernel information
Set the output information after authentication,
The list of file systems currently installed. Initialized by scripts and updated automatically by the Mount command. When you need a list of currently installed file systems, such as the DF command
Similar to/etc/passwd, but not the user but the group.
User database, where the domain gives the user name, real name, home directory, encrypted password, and other information of the user.
The shadow password file on the system on which the shadow password software is installed. The shadow password file moves the encrypted password in the/etc/passwd file to/etc/shadow, which is only readable by the root. This makes it more difficult to decipher the password.
Configuration files that can be sudo commands
System Log Parameter Configuration
Set up files for user account restrictions
Confirm the security terminal, that is, which terminal allows root login. Typically only virtual consoles are listed, which makes it impossible (at least difficult) to break into the system via modem or network and gain superuser privileges.
Similar to/etc/termcap, but for printers. syntax is different.
The list of trusted SHELL.CHSH commands allows the user to change the login shell within the scope specified in this file. Provides a service process for a machine FTP service FTPD checks whether the user shell is listed in the/etc/shells file, if the user is not allowed to log on.
If the server is running in xinetd mode, its script will be placed in this directory. Some systems do not have this directory, such as Slackware, and some older versions do not. Available in the newer version of Redhat Fedora.
Configuration file for/opt/
Configuration file for X_window system (version 11)
Configuration files for SGML
Configuration file for XML
When creating a user by default, copy the directory to the home directory

The default software will be stored in this directory. The second level for storing read-only user data, including the vast majority of user tools and applications.
A directory for storing x-windows;
Store the small game that xteamlinux comes with;
Linux technical documentation;
Used to store the header files needed to develop and compile applications under Linux;
Store some common dynamic link shared libraries and static archives;
The directory where the Help document resides;
Linux Open source Code, there is this directory, enthusiasts do not let go oh;
Non-essential executables (not required in single-user mode), for all users.
/usr/bin/and/usr/sbin/libraries for binary files.
Non-essential system binaries, such as: The daemon of a large number of network services.
Architecture-Independent (shared) data.
Source code, such as: Kernel source code and its header file.
X Window System version one, release 6.
The third level of local data, specific to the host computer. In general, there are further subdirectories, such as: bin/, lib/, share/. This is the/USR directory provided to the general user, where the general application software is installed;

/var includes data to be changed when the system is generally running. Each system is specific, i.e. it is not shared with other computers over the network.

log information, automatic polling by week
Timer profile directory, default by user name
Record the log in system access information files, regardless of authentication success or authentication failure will be recorded
Log The login information file, last,who,w command information from the source of this
/var/spool/ clientmqueue/
When the mail service is not turned on, all messages that should be sent to the system administrator will be stacked in this
Mail directory
than/tmp Temporary files that are allowed to be large or need to exist for a longer period of time. (Although the system administrator may not allow/var/tmp to have very old files.) Files to be changed when the
System is running correctly. Variable data for programs installed in
/usr/local (that is, programs installed by the system administrator). Note that if necessary, even locally installed programs use other/var directories, such as/var/lock.
Locks the file. Many programs follow the convention of creating a locked file in/var/lock to support their use of a particular device or file. Other programs Note that this lock file will not attempt to use this device or file.
Log files for various programs, especially login (/var/log/wtmp log all to system log-in and logoff) and syslog (/var/log/messages store all core and System program information./var/log Files often grow in uncertainty and should be cleaned up regularly.
Saves the information file about the system that is valid until the next boot. For example,/var/run/utmp contains information about the user who is currently logged on.
application caches data. This data is a time-consuming I/O or calculation result that is generated locally. The application must be able to regenerate or restore data. Cached files can be deleted without causing data loss.

Virtual file system, the kernel and process status archived to a text file (System information is stored in this directory).
For example: uptime, network. In Linux, the corresponding PROCFS format is mounted. Files in this directory can only be viewed (including root)
View memory information
Remember top and uptime? That's right! The top three average values are recorded here!
is the information that will appear when you use uptime.
Information about the processor, such as type, manufacturer, model, and performance.
The relevant parameters released when loading kernel! Check out this file to see how the system started!
The file system that is currently loaded on the system ROM!
The IRQ assignment status above the current system.
is the I/O address configured on each appliance on the system.
This is the size of the memory! It's so big, right? But don't read him!
The list of modules that our Linux has already loaded can also be thought of as drivers! The data that is already mounted on the
System is the data that is called with the Mount command!
Where is the memory that the system hangs loaded? Oh! The use of the partition is recorded here!
Using fdisk-l will all the current partition appear? There is also a record in this document Oh!
on the PCI bus bar, details of each device! Lspci can be used to check! The version of
Core is the content displayed with Uname-a!
Some of the bus devices, as well as the USB stick device is also recorded here Oh!

There are two types of device files: Block device file (b) and character device file (c)
The device files are generally stored in the/dev directory,
The common device files are described as follows:

IDE Device
SCSI devices
Standard Floppy Drive
Soft RAID devices
Local loopback device
Unlimited data reception devices, equivalent to black holes
Unlimited 0 Resources
Virtual Terminal
and the port
Control Desk
Random number devices
Random number devices

Linux directory structure detailed description

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.