This article takes as CentOS
an example
basic introduction
Linux
The file system adopts a hierarchical tree directory structure .- The top level of this structure is the root directory "
/
". Linux
Everything in the system is a file .
View root directory contents
Open the root directory " /
" and view the contents of the current directory.
cd /
ls
Analysis of each file in the root directory
Commonly used directories
-
/bin
Binary
abbreviation, this directory storescd
commonly used commands. -
What /sbins
representsSuper User
is that the system management program used by the system administrator is stored here to maintain the system. Common ones includereboot
,ifconfig
etc. -
/home
stores the home directories of ordinary users.Linux
Each user in /home has his own directory, and the directory name is the user account name. -
/root is the system administrator directory and also becomes the user home directory of
the super privileged person (i.e. ).Super User
-
/lib
is the most basic dynamic link shared library required for system startup, similar to the filesWindows
inDLL
. Most applications need to use these shared libraries. -
/etc
All configuration files and subdirectories required for system management. -
The /usr
directory is very important. Many of the user's applications and files are stored in this directory, similar to the directoryWindows
inprogram files
. Among them/usr/local
is the installation directory provided to the host for additional installation software, which is usually a program installed by compiling source code. -
/boot
stores startuplinux
-related core files, including some connection files and image files. Kernelinitrd
,vmlinux
,grub
and other files are in this directory. -
/media
Some devices automatically recognized by the Linux system, such as USB flash drives, optical drives, etc., will be mounted in this directory after the system recognizes them. -
The /mnt
system provides this directory to allow users to temporarily mount other file systems. For example, shared folders are usually mounted in/mnt/hgfs/
the directory. (For details, please see the record of VMware setting up Linux and Windows shared folders ). -
/opt
opt
representsopitional
, this is the directory where additional installed software is stored for the host, and is empty by default. -
/var
This directory stores continuously expanding data. Frequently modified files are usually placed in this directory. For example, system log file (/var/log
), email (/var/mail
), print queue (/var/spool
), etc.
Be careful with directories
These directories involve files that are operated by the system. Once modified, they may cause the entire system to crash.
-
/proc
is a virtual directory, which is a mapping of system memory. Information such as system processes can be obtained by accessing this directory. -
/srv
is the abbreviation of service. This directory stores some data that needs to be extracted after the service is started. -
/sys
All configuration files and subdirectories required for system management.
Other directories
-
/tmp
is a directory used to store some temporary files. Once the system is restarted, the files in this directory will be deleted. -
/dev
stores hardware information, similar toWindows
the device manager,Linux
which maps and stores all hardware devices in the form of files, including files such ascpu
.disk
-
/lost+found
This directory is usually empty and is used to store some related files when the system is shut down illegally. -
/selinux
issecurity-enhanced linux
aSELinux
security subsystem that controls programs to only access specific files.