Linux system directory structure detailed

Source: Internet
Author: User


One of the notable differences between Linux and Windows systems is that the directory structure is different, and the directory structure of Linux follows the file system hierarchy standard. The directory structure of Linux is more complex, but the setting is reasonable and clear. We can consider the entire Linux file system as a tree whose roots are called root directories, denoted by/. This article will explain the directory structure of Linux and its storage content.


The root directory has the following subdirectories:

/bin: This directory contains commands to complete basic maintenance tasks for all users. Where bin is a binary abbreviation that represents a binary file, typically an executable file. Some commonly used system commands, such as CP, LS, etc., are saved in this directory.


/boot: This directory contains some of the core files (Lilo or grub) that need to be loaded when the Linux system starts up, including some connection files and image files.


/dev:dev is a device abbreviation that contains all the system device files used by Linux, such as CD-ROM, disk drives, modems, and memory. System devices are considered files, from which a variety of system devices can be accessed. This directory also contains a variety of useful features, such as Makedev for creating device files.


/etc: This directory contains configuration files for system and application software, and also contains scripts to start and close a particular program.

/ETC/PASSWD: This directory contains user-descriptive information from the system, with each row recording a user's information.


/home: This directory is a personal file that stores ordinary users. In Linux, each user has a home directory named after his or her account, which is used to hold the user's data.


/lib: This directory contains the most basic Linux system shared link libraries and kernel modules, the shared link library is functionally similar to the. dll file in Windows, and almost all applications will use the library files in that directory.


/lib64:linux 64-bit system has this folder, a library of 64-bit programs.


/lost+found: This is not part of the Linux directory structure, but rather the ext3 file system is used to save lost files. Improper shutdown and disk errors can result in file loss, which means that these are labeled "in use" but are not listed on the data structure on disk. Normally, the boot process runs the FSCK program, which can discover these files. In addition to this directory on the "/" partition, there is a lost+found directory on each partition. The directory is empty in general. Some files are temporarily stored here when there is a sudden power outage or when Linux is not properly shut down.


/misc:misc means a clutter box, which allows multiple users to accumulate and temporarily transfer their files.


/media: This directory is a mount point for removable devices, and the Linux system typically automatically mounts devices such as USB drives to that directory.


/MNT: This directory is where the file system is temporarily mounted. In general, this directory is empty, and when we are going to mount the partition, we will set up a directory in this directory, and then mount the device we are going to access in this directory so that we can access the files inside the device.


/OPT: Most third-party software is installed by default in this directory, such as Adobe Reader, Google-earth, and so on. So you don't have to install this kind of software when it is empty. Not every system will create this directory.


/proc: It is an in-memory virtual file system that contains system information such as kernel and process status, mostly text files, which can be viewed directly. For example,/proc/cpuinfo saves information about the CPU. This information is generated in memory by the system, and the contents of the directory are not on the hard disk and in memory.


/root: The home directory of the root user (also called the Superuser or system administrator) that holds the root user's personal files.


/sbin:s is the meaning of super user, which contains executable files for root users, mostly system management commands, such as fsck, reboot, shutdown, ifconfig, etc., for system maintenance.


/selinux: This directory is unique to Redhat/centos, SELinux is a security mechanism, similar to Windows Firewall, but this mechanism is more complex, this directory is to store selinux related files.


/srv: This directory holds data that needs to be extracted after some services are started.


/sys: This directory installs a new file system that appears in the 2.6 kernel SYSFS,SYSFS file system integrates the following 3 file system Information: Proc File system for process information, DEVFS file system for devices, and devpts file system for pseudo terminal. The file system is a visual 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. This is a big change in the linux2.6 kernel.


/tmp: This directory is used to save temporary files that are generated when different programs are executed. This directory has sticky special permissions that allow all users to create and edit files in this directory. However, only the file owner can delete the file. In order to speed up the access of temporary files, some implementations put/tmp in memory.


/USR:USR is the initials of the user, which is often considered an abbreviation for the user System resources, which usually holds the application software, such as users, similar to the Program Files directory under Windows.

/usr/bin: Storing most of the daily application management programs and System daemons is a complement to/bin.

/usr/include: directory where the System/C + + header files are stored.

/usr/lib: The library file that holds the system.

/usr/local: Contains the user compiled source code installation of the application, the software installed in the/usr/local directory structure is similar to/usr.

/usr/local/bin: It may be a small application installed by the user, and some symbolic connections to large applications in the/usr/local directory.

/usr/sbin: System management programs, such as apache2, are not used in single-user mode.

/usr/share: Schema-independent data, where most software is installed.

/USR/SRC: Store Linux kernel source code.

/USR/X11R6: Save all the files required to run X-window, which also contains the configuration files and binaries to run the GUI.


/var: This directory is a growing directory of data files that are often modified, including various log files.

/var/cache: Cache files for Applications

/var/lib: Application information, data. such as database data, etc. are stored in this folder.

Information and data of the program in/var/local:/usr/local

/var/lock: Lock File

/var/log: Log file

Information and data of the program in/var/opt:/opt

/var/run: Information about the program being executed, such as the PID file should be stored in this

/var/spool: Storing the program's spool data (that is, spool)

/var/tmp: Temp File



In the Linux system, there are several directories are more important, usually need to be careful not to accidentally delete or arbitrarily change the internal files.

/etc: Also mentioned above, this is the configuration file in the system, if you change a file in this directory may cause the system will not start.

/bin,/sbin,/usr/bin,/usr/sbin: This is the system preset execution file placement directory, such as LS is in the/bin/ls directory. It is worth proposing that/bin,/usr/bin is the instruction for the user of the system (except for root), and/sbin,/usr/sbin is the command to use for root.

/var: this is a very important directory, the system ran a lot of programs, then each program will have a corresponding log generated, and these logs are recorded in this directory, specifically in the/var/log directory, the other mail preset placement is also here.


Resources:

Linux directory structure


This article comes from "a lot more to learn" blog, make sure to keep this source http://i12learn.blog.51cto.com/8367297/1545180

Linux system directory structure detailed

Related Article

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: info-contact@alibabacloud.com 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.