Linux Standard directory structure

Source: Internet
Author: User

First, with the 21st understanding

Beginner Linux, you need to understand the Linux standard directory structure first

/

  • Root---Some of the core files used when starting Linux. such as operating system kernel, boot program grub and so on.
  • Home---Store personal files for ordinary users
    • FTP---User-owned services
    • httpd
    • Samba
    • User1
    • User2
  • Bin---execution file (binary) required for system startup
  • Sbin---executable program directories, but most of them contain commands that involve system administration. Only root privileges can be performed
  • Proc---Virtual, there is a Linux kernel image, save all kernel parameters and system configuration information
    • 1---process number
  • USR---user directory, storing user-level files
    • Bin---commands used by almost all users, in addition to the presence of/bin,/usr/local/bin
    • Sbin---system administrator commands, related to users, for example, most server programs
    • Include--- the directory where C + + header files are stored
    • LIB---fixed program data
    • Local---Where to save the locally installed software
    • Man---manual-generated directory
    • Info---information document
    • Doc---Different package document information
    • Tmp
    • X11R6--- This directory is used to save all the files that are required to run X-window. The directory also contains the configuration files and binaries that are used to run the GUI.
    • X386---Features with x11r6,x11 release 5 system files
  • Boot---Boot loader required files, the system needs the picture saved in this
  • LIB---The Common library of programs and core modules under the root file system directory
    • Modules---loadable module, reboot required module after system crash
  • Dev---device file directory
  • ETC---configuration file
    • Skel---Home directory, this directory is initialized
    • Sysconfig---network, time, keyboard and other configuration directory
  • Var
    • File
    • Lib---Files in this directory will change when the system is running
    • Local---Program data installed in the/usr/local, changing the
    • Lock---File is locked with a specific peripheral or file and other files are temporarily inaccessible
    • Log---Logging
    • Run---system running legitimate information
    • Spool---printer, mail, proxy server, etc. spool directory
    • Tmp
    • Catman---cache directory
  • MNT---A temporary place to mount the file system. 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 file.
  • TMP---Temp file directory, temporary files after system startup are stored in/var/tmp
  • Lost+found---Files recovered during file system repair

/: root directory, directory only, general root directory, do not store files,/etc,/bin,/dev,/lib,/sbin should and root directory placed in a partition

/bin:/usr/bin: A directory that executes binary files, such as common commands ls, tar, MV, Cat, and so on.

/boot: Place Some files that are used by the Linux system when it is started. /boot/vmlinuz is the kernel file for Linux, as well as/boot/gurb. recommended separate partition, partition size 100M

/dev: store the device files under the Linux system and access a file in that directory, equivalent to accessing a device, which is commonly used to mount the optical drive mount/dev/cdrom/mnt.

/etc: the directory where the system configuration file is stored, the executable file is not recommended in this directory, the important configuration files are/etc/inittab,/etc/fstab,/ETC/INIT.D,/etc/x11,/etc/sysconfig, /etc/xinetd.d remember to back up before modifying the configuration file.

Note:/etc/x11 stores settings related to x Windows.

/home: The Default User house directory, when adding user accounts, the user's home directory is stored in this directory, ~ represents the current user's home directory, ~test represents the user test home directory. It is recommended to separate partitions and set up a large disk space for user-friendly data storage

/lib:/usr/lib:/usr/local/lib: The system uses the library's directory, the program in the execution process, need to call some additional parameters when the function library assistance, the more important directory is/lib/modules.

/lost+fount: When a system exception is generated, some missing fragments are placed in this directory, which usually appears automatically in the Appliance directory. If the hard drive is loaded in/disk, the directory will be automatically generated in this directory/disk/lost+found

/mnt:/media: cd default mount point, usually the disc is mounted under/mnt/cdrom, or not necessarily, you can choose any location to mount.

/opt: A directory for the host to install additional software. For example: The Fedora Community development software used by FC4, if you want to install new KDE desktop software yourself, you can install the software in this directory. In the previous Linux system, it is customary to place it in the/usr/local directory

/proc: This directory data are in memory, such as system core, external device, network status, because the data are stored in memory, so do not occupy disk space, the more important directory has/proc/cpuinfo,/proc/interrupts,/proc/ DMA,/proc/ioports,/proc/net/*, etc.

/root: system Administrator Root home directory, the system first boot partition is/, so it is best to put/root and//placed under a partition.

/sbin:/usr/sbin:/usr/local/sbin: Place executable commands that the system administrator uses, such as Fdisk, Shutdown, Mount, and so on. Unlike/bin, these directories are commands for the root of the system administrator, and the average user can only "view" and not be set up and used.

/ tmp: the directory where the files are temporarily stored by the general user or the program being executed, accessible to anyone, important data cannot be placed in this directory

/srv: The data directory that needs to be accessed after the service starts, such as the Web page data that the WWW service needs to store within/SRV/WWW

/usr: application store directory,/usr/bin store application,/usr/share store shared data,/usr/lib storage cannot be run directly, is a number of function library files that are required for many programs to run. /usr/local: store the software upgrade package. /usr/share/doc: system description file storage directory. /usr/share/man: Program Description file directory, when using the man LS will query/usr/share/man/man1/ls.1.gz content recommended separate partition, set a large disk space

/var: Place files that change frequently during the execution of the system, such as log files that change at any time/var/log,/var/log/message: All the login files are stored in the directory,/var/spool/mail : The directory where the mail is stored,/var/run: after the program or service starts, its PID is stored in the directory. It is recommended to separate partitions to set large disk space

Second, the combination of the first understanding

Unlike windows, which sees the hard disk as a "C-drive", "D-Drive" Partition, Linux sees the entire filesystem as a tree whose roots are called the root filesystem. Each partition is accessed as a folder by mounting (Mount).

There are a lot of folders in / , this article describes the meaning of common folders. The directory structure of Linux is quite complex, but it is set up reasonably and clearly. This article takes FHS 2.3 as an example to introduce.

/bin root File system
This directory contains commands to complete basic maintenance tasks that are available to 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
Here are some of the core files used when starting Linux. such as operating system kernel, boot program grub and so on.
/dev
All system device files are included in this directory. Various system devices can be accessed from this directory. such as CD-ROM, disk drives, modems, and memory. This directory also contains a variety of useful features, such as Makedev for creating device files.
/etc
This directory contains the configuration files for the system and application software.
/etc/passwd
The directory contains user-descriptive information from the system, with each row recording a user's information.
/home
Store personal files for normal users. Each user's home directory is named under their own user name under//.
/lib
This directory contains the system's most basic shared-link libraries and kernel modules. The shared link library is functionally similar to a. dll file in Windows.
/lib64
The
64-bit system has a library of this folder, 64-bit programs.
/lost+found
This is not part of the Linux directory structure, but rather the place where 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.
/media
Removable device mount point, the current operating system will usually be a USB drive and other devices automatically mounted to the folder.
/mnt
a temporary place to mount the file system. 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 file. (Note that in GNOME, only the folders that are mounted to /media will be displayed in the "Computer" and mounted to the /mnt will not be displayed as a special device, see automatically mount partitions)
/opt
Most third-party software is installed to this location by default, such as Adobe Reader, Google-earth, and so on. Not every system will create this directory.
/proc
It is a virtual file system that exists in memory. It holds the kernel and process state information. Many are text files and can be viewed directly. For example, /proc/cpuinfo saves information about the CPU.
/root
This is the root user's home directory. Similar to the directory under/ home that is reserved for individual users, this directory also contains entries that are only related to the root user.
/sbin
executable files for super users, many of which are system administration commands such as fsck, reboot, shutdown, ifconfig, etc.
/tmp
This directory is used to save temporary files. 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
static user-level applications, etc., see below.
/var
Dynamic Program data, etc., see below.
/ USR directory structure

/ usr is typically a large folder under which the directory structure is similar to the root directory, but the files in the root directory are mostly system-level files, and/ usr is a user-level file that is generally independent of the specific system.

Tips:
USR is the first user abbreviation, / usrThe role of the present /HomeSame. At present, it is usually considered as the abbreviation of the user system Resources, which is usually the customer-level software, and compared with the root directory of the system-level files. [2]

It should be noted that the program configuration files, Dynamic Data files, etc. will not be stored to/ usr, so in addition to installing, uninstalling the software, generally do not need to modify the content in/ usr . Said/usr can even be read-only mounted while the system is operating normally. Because of this feature,/usr is often divided into separate partitions, and sometimes multiple computers can share a/ usr.

/usr/bin
where most everyday applications are stored. If/ usr is placed in a separate partition, Linux single-user mode cannot access /usr/bin, so programs that are critical to the system should not be placed in this folder.
/usr/include
directory where the C + + header files are stored
/usr/lib
system's library file
/usr/local
This folder is empty in the newly installed system and can be used to store personal installation software. The directory structure in the /usr/local with local software is similar to/ usr
/usr/sbin
System Management programs, such as apache2, are not used in single-user mode.
/usr/share
schema-independent data. Most software is installed here.
/usr/x11r6
This directory is used to save all the files that are required to run X-window. The directory also contains the configuration files and binaries that are used to run the GUI.
/usr/src
Source Code
/ VAR directory structure

The/ var includes some data files, such as system logs. The storage of/ var makes it possible for/ usr to be read-only mounted.

/var/cache
Cache files for Applications
/var/lib
The information and data of the application. such as database data, etc. are stored in this folder.
/var/local
Information and data of the program in /usr/local
/var/lock
Lock file
/var/log
Log file
/var/opt
Information and data of the program in /opt
/var/run
Information about the program being executed, such as the PID file should be stored in this
/var/spool
Store the program's spool data (that is, spool)
/var/tmp
Temporary Files

Linux Standard directory structure

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.