Detailed Explanation of CentOS Directory

 In centos, the topmost directory is called the root directory, represented by /. Under the / directory, users can create directories again, but some directories already exist with the system creation. Next, we will focus on introducing several commonly used directories.

/bin (binary) contains many executable files that all users can access, such as ls, cp, cd, etc. Most programs here are in binary format, hence the name bin directory.

/dev (device file) is usually mounted on the devtmpfs file system, which stores device file nodes. Usually mapped directly to memory, rather than stored on physical disk. It is worth mentioning that there are several interesting files, which are virtual devices.

  • /dev/null is a virtual device that can be used to destroy any output. You can use the > redirection symbol to redirect any output stream to /dev/null to ignore the output result.
  • /dev/zero is a virtual device that produces the number 0. It will read 0 no matter how many times you read it.
  • /dev/ramdom is a virtual device that generates random numbers. Read the data in this file and you will get a random number. You keep reading this file and you get a sequence of random numbers.

/etc (configuration file), the meaning of the name /etc is and so on..., that is, "etc and others", Linux uses it to save the configuration of the program. For example, mysql usually creates configurations under /etc/mysql. For another example, /etc/passwd is the user configuration of the system, which stores user information.

/proc (process, process and kernel files) Stores information about executing processes and kernels. For example, you can find all the information associated with process 1122 through the /proc/1122 directory. The important file information in the directory is as follows:

  • /proc/cpuinfo stores information about the processor (cpu), such as the type, manufacturer, model, and performance of the cpu.
  • /proc/devices List of device drivers for the currently running kernel configuration.
  • /proc/dma displays the currently used dma channel.
  • /proc/filesystems File system information for core configuration.
  • /proc/interrupts Display information about interrupts that are occupied, who owns them, and how many are occupied.
  • /proc/ioports currently used i/o ports.
  • /proc/kcore system physical memory image. Exactly the same size as physical memory, but doesn't actually take up that much memory; it's only created when a program accesses it. /proc/kmsg Messages output by the kernel.
  • /proc/ksyms Kernel symbol table.
  • /proc/loadavg System "load average.
  • /proc/meminfo Various memory usage information, including physical memory and swap partition (swap).
  • /proc/modules stores information about which core modules are currently loaded.
  • /proc/net Network protocol status information.
  • /proc/self Holds a symbolic link to the process directory of the program looking at /proc.
  • /proc/stat various states of the system
  • /proc/uptime Length of time the system has been up.
  • /proc/version

/sbin (super binary system binary) Similar to /bin, it is usually a necessary command for system startup, and it is a dedicated binary code storage directory for system administrators.

/tmp (temporary file) is used to store temporary files for applications, usually using the tmpfs file system. Because tmpfs is a memory file system, the /tmp file is cleared when the system is restarted, so applications and important data cannot be placed in this directory.

/var (Variable data file, variable data file) is used to store runtime data, each system is specific, that is, it is not shared with other computers through the network. For example, logs are usually stored under the /var/log directory. Another example is application cache files, user login behavior, etc., which can be placed in the /var directory, and the files under /var will be stored for a long time. in:

  • /var/lib Files that are changed during normal system operation.
  • /var/local Stores variable data for programs installed in /usr/local (that is, programs installed by the system administrator). Note that even locally installed programs use other /var directories, such as /var/lock, if necessary.
  • /var/lock lock file. Many programs follow the convention of generating a lock file in /var/lock to support that they are using a particular device or file. Other programs notice this lock file and will not attempt to use the device or file.
  • /var/log Log files of various programs, especially login (/var/log/wtmp log all logins and logouts to the system) and syslog (/var/log/messages store all core and system program information. /var The files in /log often grow indefinitely and should be purged periodically.
  • /var/run holds information about the system that is valid until the next boot. For example, /var/run/utmp contains information about the currently logged in user.
  • /var/spool Directory for mail, news, print queues, and other queue work. Each different spool has its own subdirectory under /var/spool, for example, user mailboxes are in /var/spool/mail.
  • /var/tmp Temporary files that are larger than /tmp allows or need to exist for a longer time. (Although system administrators may not allow /var/tmp to have very old files.)

Linux kernel files and boot images are stored in the /boot (startup) directory. Usually, this directory will be written to the top partition of the disk, and the files in the directory need to be loaded when starting.

/opt (Optional Software, optional software) usually installs third-party software to this directory. When you install the software in the future, you can consider creating it in this directory.

/root (root user's home directory) In order to prevent misuse, the root user's home directory is not designed under /home/root in Linux design, but placed in the /root directory.

/home (home directory) is used to store the user's personal data, for example, the personal data of user kevin will be stored under /home/kevin. And usually after the user logs in or executes the cd command, they will work in the home directory. Users usually have administrative rights to their own home directories, but cannot access other users' home directories.

/media (media) Automatically mounted devices usually appear in the /media directory. For example, if you insert a USB flash drive, usually newer versions of Linux will automatically complete the mounting for you, that is, create a directory under /media to represent the USB flash drive.

/mnt (Mount, mount) We are used to put manually mounted devices into this directory. For example, after you insert the U disk, if Linux does not complete the automatic mounting for you, you can use the mount command to manually mount the contents of the U disk to the /mnt directory.

/srv (Service Data, service data) is usually used to store service data, such as website resource files (scripts, web pages, etc.) you develop. But now the habits of many teams have changed. Some teams will put website-related resources in the /www directory, and some teams will put them in /data. In short, from the perspective of storing resources, it is relatively flexible.

/usr (Unix System Resource) contains the resource files required by the system. Usually, the application program will also put the executable files installed later in this directory. For example, the executable files of the vim editor are usually in the /usr/bin directory , different from ls will be in the /bin directory

  •  /usr/bin/ Running scripts of some software installed later
  • /usr/sbin will contain commands that are usually used by system administrators.
  • The library files of the system are stored in the /usr/lib directory, such as some important objects and dynamic link library files.
  • The /usr/share directory mainly contains documents. For example, man documents are all under /usr/share/man.

Guess you like

Origin blog.csdn.net/liwenxiang629/article/details/131780522