Linux file system structure

Linux file system structure

The most commonly used directories in Linux systems are:

  • home : user directory
  • usr : Unix Software Resource installed software directory

This article introduces the structure and function of the Linux root directory:

/bin

bin is the abbreviation of Binary (binary), this directory stores the most frequently used commands.

/boot

This directory is mainly for files that will be used for booting, including Linux kernel files, boot menus, and configuration files required for booting.

/dev

dev is the abbreviation of Device (device). This directory stores the external devices of Linux. The way to access devices in Linux is the same as the way to access files.

/etc

This directory is used to store all configuration files and subdirectories required for system management, such as personnel account password files, start files of various services, etc. Generally speaking, the attributes of each file in this directory can be viewed by ordinary users, but only root has the right to modify it. The more important files are /etc/init.d, /etc/inittab, /etc/sysconfig and so on.

/home

The user's home directory. In Linux, each user has its own directory. Generally, the directory name is named after the user's account.

/lib

Place shared function libraries, which are needed by almost all applications.

/lost+found

This directory is usually empty. When the system is shut down illegally, some files are stored here. The purpose is equivalent to placing some missing fragments in this directory when a file system error occurs . This directory will usually exist at the top level of the partition.

/media

The linux system will automatically recognize some devices, such as U disk, CD-ROM, etc. After recognition, linux will mount the recognized device to this directory.

/ mnt

The system provides this directory to allow users to temporarily mount other file systems. We can mount the CD-ROM drive on /mnt/, and then enter this directory to view the contents of the CD-ROM drive.

/opt

This is the directory where additional software is installed for the host. For example, if you install an ORACLE database, you can put it in this directory. Default is empty. The installation location can be specified by the user himself. When you need to uninstall third-party applications, you can directly delete the installation directory without affecting any other settings of the system.

/proc

This directory itself is a virtual filesystem (virtual filesystem), which is a mapping of system memory. The data it places is in memory, such as the system kernel, processes, external devices, and network status. We can get system information by accessing this directory directly. We can also directly modify some files in it, for example, we can block the ping command of the host through the following command, so that others cannot ping your machine:

echo 1 > /proc/sys/net/ipv4/icmp_echo_ignore_all

/root

This directory is the home directory of the system administrator, also known as the super-authorized user. The reason for this is because if you enter single-user maintenance mode and only mount the root directory, the directory can have the root's home folder, so we want the root's home folder and the root directory to be placed in the same partition. middle.

/sbin

s means Super User, which stores the system management program used by the system administrator. It is used to "set" the system, and other users can only use it to "query" at most. The ones placed under /sbin are required during the boot process, including the commands required for booting, repairing, and restoring the system.

/srv

srv can be regarded as the abbreviation of "service", this directory stores some data that needs to be extracted after the service is started. Common services such as WWW, FTP, etc. For example, web page data required by the WWW service can be placed in /srv/www/.

/sys

This directory is actually very similar to /proc, and it is also a virtual file system, which mainly records information related to the kernel . Including currently loaded kernel modules and hardware device information detected by the kernel, etc. This directory also does not occupy the hard disk capacity. The filesystem is a visual reflection of the kernel device tree. When a kernel object is created, corresponding files and directories are also created in the kernel object subsystem.

/tmp

This is a place for a general user or a program that is executing to temporarily place files. This directory is accessible to anyone, so you need to clean it up regularly. Of course, important data cannot be placed in this directory, because the system will delete all the data in the /tmp directory from time to time .

/usr

Abbreviation for Unix Software Resource, which is the directory where " UNIX operating system software resources " are placed. This is a very important directory. Many applications and files of the user are placed in this directory, similar to the program files directory under Windows.

FHS recommends that all software developers should place their data reasonably in subdirectories of this directory, rather than creating a separate directory for the software on their own.

  /usr/bin/ : Most of the commands available to users are placed here

  /usr/include/ : Where the header files (header) and include files (include) of programming languages ​​such as C/C++ are placed

  /usr/lib/ : Contains function libraries, object files and some executable files or scripts that are not used by general users

  /usr/local/ : It is recommended that the system administrators install and download software on this machine to install to this directory

  /usr/sbin/ : System commands required for the normal operation of the non-system

  /usr/share/ : where shared files are placed

  /usr/src/ : General source code is recommended to be placed here

/where

This directory is mainly for normally variable files, including cache (cache), log file (log file), and files generated by some software running, including program files (lock file, run file), or files such as MySQL database, etc. .

If /usr is a directory that will take up a large amount of hard disk capacity during installation, then /var is a directory that will gradually take up hard disk capacity after the system is running.

  /var/cache/ : some temporary files generated during the running of the application itself

  /var/lib/ : The directory where the data files that need to be used are placed during the execution of the program itself

  /var/lock/ : The file resources in the directory can only be used by one application at a time

  /var/log/ : directory where log files are placed

  /var/mail/ : directory where personal email mailboxes are placed

  /var/run/ : PID directory after some programs or services are started

  /var/spool/ : Places data queued for use by other applications

refer to:

https://www.cnblogs.com/woider/p/6618295.html

http://www.runoob.com/linux/linux-system-contents.html

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324689600&siteId=291194637