A detailed explanation of the file structure under Linux

Source: Internet
Author: User
Tags data structures memory usage temporary file storage

/bin binary Executable command
/dev Device Special files
/ETC System Management and configuration files
/ETC/RC.D boot configuration files and scripts
/home user home directory, such as the user's home directory is/home/user, you can use ~user Express
/lib Standard Programming Library, also known as the dynamic Link shared library, functions like a. dll file in Windows
/sbin System Management commands, where the Administrator program is used by the system administrators
/tmp temporary file storage point for public
/root system Administrator's home directory (hehe, privileged Class)
The/MNT system provides this directory to allow users to temporarily mount other file systems.
/lost+found This directory is usually empty, the system is not normal shutdown and leave the "Homeless" files (Windows under the name. chk) right here.
/proc virtual directory, which is the mapping of system memory. You can access this directory directly to obtain system information.
/var some large-file overflow areas, such as log files for various services
The largest directory in/USR, the applications and files to be used are almost always in this directory. which contains:
/USR/X11R6 the directory where x window is stored
/usr/bin a wide range of applications
/usr/sbin Some management programs for super users
/usr/doc Linux Documentation
/usr/include Linux to develop and compile the header files needed for the application
/usr/lib commonly used dynamic-link libraries and package configuration files
/usr/man Help Document
/USR/SRC source code, the Linux kernel code is placed in the/usr/src/linux
/usr/local/bin locally added command
/usr/local/lib locally added libraries

Typically, the root file system takes up less space because most of the files do not need to be changed frequently, and a strict file and a small infrequently changing file system are not susceptible to damage. The root directory does not normally contain any files except for a possible system boot image called/V m l i n u z standard. All other files are in subdirectories of the root file system.
1./bin Directory
/b i n directories contain the commands that are required to boot up or the commands that ordinary users may use (possibly after boot startup). These commands are binary executable programs (b i n is b i n a r y-the abbreviation of binary), many are important system files in the system.
2./sbin Directory
The/s b i n directory is similar to/bin and is also used to store binary files. Because most of these files are mostly system administrators use the basic System program, so although ordinary users are necessary and allowed to use, but generally not for ordinary users.
3./etc Directory
/e T C directory contains a variety of system configuration files, including user information files/E t c/p a s W d, System initialization files/E t c/r c. L i n u x exactly * These files are able to run normally.
4./root Directory
The/root directory is a superuser's directory.
5./lib Directory
/L I b directory is the shared library required by the program on the root file system, which holds the shared files required for the root file system program to run. These files contain code that can be shared by many programs to prevent each program from containing copies of the same subroutine, making the executable file smaller and less space-saving.
6./lib/modules Directory
The/lib/modules directory contains system cores that can load various modules, especially those needed to reboot the system when the damaged system is restored (for example, network and file system drivers).
7./dev Directory
The/d e v Directory stores the device files, which are device drivers, through which users access external devices. For example, a user can access the mouse input by accessing/d e v/m o u S e, just like accessing other files.
8./tmp Directory
The/tmp directory stores the information and data generated by the program at run time. However, after boot startup, the running program is best to use/V a r/t m p instead of/tmp, because the former may have a larger disk space.
9./boot Directory
The/b o T directory holds files used by the boot loader (bootstrap loader), such as L l O, where core images are often placed rather than in the root directory. But if there are a lot of core images, this directory can become very large, then it would be better to use a separate file system. It is also important to ensure that the core image must be in the top 1 0 2 4 cylinders of the I d e hard disk.
/mnt Directory
/m N T directory is the installation point of the system administrator temporary installation (M o u n T) file system. The program does not automatically support installation to/mnt. /mnt can be divided into many subdirectories, such as/mnt/dosa may be using the M S d o s file system floppy drive, and/mnt/exta may be using the E x T 2 file system floppy drive,/mnt/cdrom Optical drive, and so on.
/proc,/usr,/var,/home Directory
Installation points for other file systems.

The following detailed description;
/ETC File System
The/ETC directory contains a variety of system configuration files, some of which are described below. Other you should know which program they belong to and read the program's M a n page. Many network configuration files are also in/etc.
1./ETC/RC or/etc/rc.d or/ETC/RC? D
The directory of scripts or scripts that run when the run level is started, or changed.
2./etc/passwd
User database, where the domain gives the username, the real name, the user's starting directory, the encrypted password, and other information about the user.
3./ETC/FDPRM
The floppy disk parameter table that describes the different floppy disk formats. Can be set with SETFDPRM. For more information see the help page for S e t f D p R M.
4./etc/fstab
Specifies the list of file systems that need to be installed automatically at startup. Also includes information on the S W a p area enabled with Swapon-a.
5./etc/group
Similar to/etc/passwd, but not the user information but the group information. Includes various data for the group.
6./etc/inittab
The configuration file for init.
7./etc/issue
Includes the user's output information before the logon prompt. Usually includes a short description of the system or a welcome message. The specific content is determined by the system administrator.
8./etc/magic
The configuration file for "F i l E". Contains a description of the different file formats, "F i l E" based on its guessing file type.
9./ETC/MOTD
M o D is the abbreviation for message of the day, which is automatically exported after the user successfully logs in. The content is determined by the system administrator. Often used to advertise information, such as warnings about scheduled shutdown times, and so on.
/etc/mtab
List of currently installed file systems. Initialized by the script (s C r i t p) and automatically updated by the Mount command. Used (for example, DF command) When a list of currently installed file systems is required.
/etc/shadow.
Shadow password file on a system with shadow (s h a d o W) password software installed. The shadow password file moves the encrypted password in the/E t c/p a s W d file to/E t C/s h a D o W and the latter is readable only for the superuser (r o T). This makes it more difficult to decipher the password, thus increasing the security of the system.
/etc/login.defs
L o g i n command configuration file.
/etc/printcap
Similar to/etc/termcap, but for printers. syntax is different.
/etc/profile,/E t/C s H. L o g i n,/ETC/CSH.CSHRC
Log on or start when B o u r n E or C shells executes the file. This allows the system administrator to establish a global default environment for all users.
/etc/securetty
Confirm the security terminal, which terminal allows the superuser (r o T) to log in. Typically, only the virtual Console is listed, which makes it impossible (at least difficult) to break into the system via a modem (M o d e m) or network and gain superuser privileges.
/etc/shells
List the available S H e L. The CHSH command allows the user to change the login s H e l l in the specified scope of this document. Provides a service process for a machine F t service ftpd Check if the user s H e l L is listed in the/etc/shells file, and if not, the user will not be allowed to log on.
/etc/termcap
Terminal Performance database. Describes what "escape sequence" controls are used by different terminals. Instead of directly outputting the escape sequence when writing a program (which works only with a specific brand of terminals), you can find the correct sequence of work to do from the/etc/termcap.
In this way, most programs can run on most terminals.

/dev File system
The/dev directory includes device files for all devices. The device file is named with a specific convention, as described in the device list. The device file is generated by the system during installation and can be described later with/dev/makedev. /d e v/m a k e d e v.local is a descriptive document written by a system administrator for a local device file (or connection) (that is, some non-standard device drivers are not part of the standard Makedev). Below is a brief introduction to some of the common files below/d e v.
1./dev/console
System console, which is a monitor connected directly to the system.
2./dev/hd
I d e HDD driver interface. For example:/d e v/h D a means the first hard drive, h a D 1 is the first partition of/d e v/h D. If there are other hard drives in the system, then/d e v/h D B,/d e v/h D C 、...... If there are multiple partitions, then H d a 1, h D a 2 ...
3./DEV/SD
s C S I disk driver interface. If the system has s C s I hard drive, it will not access/d e v/h a D, but will access/d e v/s D a.
4./dev/fd
Floppy drive device driver. For example:/d e v/f D 0 refers to the system's first floppy disk, which is commonly referred to as a: disk,/d e v/f D 1 refers to the second floppy disk, ... and/d e v/f d 1 h 1 4 4 0 indicates access to 1 in drive 4. 5 High density disk.
5./dev/st
s C S I tape drive driver.
6./dev/tty
Provides Virtual Console support. such as:/d e v/t T y 1 refers to the system's first Virtual Console,/d e v/t T y 2 is the second Virtual Console of the system.
7./dev/pty
Provide remote login pseudo terminal support. The/d e v/p T-y device is used when you log on te l n e T.
8./dev/ttys
Computer serial interface, for D o S is "c o M 1" port.
9./dev/cua
A computer serial interface, a device used with a modem.
/dev/null
"Black hole", all information written to the device will disappear. For example, when you want to hide the output information on your screen, simply enter the output information into the/d e v/n u l L.

/usr file system
/usr is a very important directory, usually a large file system, because all programs are installed here. All files in/usr generally come from l i n u x distributions (d i s t r i b u t i o n); locally installed programs and other things are under/usr/local, because this allows you to upgrade a new system or release without reinstalling All programs. Many of the contents of the/usr directory are optional, but these features make it more efficient for users to use the system. /U S R can accommodate many large packages and their configuration files. Some important directories are listed below (some of the less important directories are omitted).
1./usr/x11r6
Contains all executable programs, configuration files, and supporting files for x WI n d o systems. To simplify X's development and installation, X's files are not integrated into the system. X wi n d o W system is a powerful graphical environment that provides a large number of graphical tool programs. If the user is familiar with Microsoft WI n d o w s or m a c h o s H, it will not be able to feel helpless with the x wi n d o w system.
2./usr/x386
Similar to/U S r/x 11r6, but is specifically for x one release 5.
3./usr/bin
Centralized almost all user commands, is the system's software library. Some other commands are in/bin or/usr/local/bin.
4./usr/sbin
Includes system management commands that are not necessary for the root file system, such as most service programs.
5./usr/man,/U s r/i n f o,/u S r/d o C
These directories contain all the man pages, G n u information documents, and various other document files. The section of each online manual has two subdirectories. For example:/u S r/m a n/m a N 1 contains the source code (unformatted original file) in the first section of the online manual,/u s r/m a n/c a T 1 contains the formatted contents of the first section. The online manual is divided into the following nine sections: internal commands, system calls, library functions, devices, file formats, games, macro packages, System management, and core programs.
6./usr/include
Contains the C language header files, which are more than a few files. H ends to describe the data structures, subroutines, and constants used in the C language program. In order to maintain consistency, this should actually be placed under/usr/lib, but it is customary to use this name
Word.
7./usr/lib
Contains unchanging data files for programs or subsystems, including some s i t e-w i d e configuration files. The name L I b comes from the library. The original library of programming also exists in/usr/lib. When the program is compiled, the program connects to the library. There are also many programs that deposit configuration files into them.
8./usr/local
Locally installed software and other files are placed here. This is very similar to/U S R. The user may find some larger packages here, such as T e X, E m a C s, etc.

/var File System
/var contains data to be changed when the system is normally run. Typically, the size of the directory where the data resides is constantly changing or expanding. The original/V a r directory contains some content in/U S R, but in order to keep/U S r directory relatively stable, put those that need to change frequently in the directory/V a r. Each system is specific, that is, not shared with other computers over the network.
Some important directories are listed below (some of the less important directories are omitted).
1./var/catman
Includes the formatted Help (m a N) page. The source files for the help page are generally present/U s r/m a n/m a n; some m a n pages may have preformatted versions, existing/U s r/m a n/c a T. While the other m a N pages need to be formatted for the first time, the formatted version exists in/var/man so that others do not have to wait for formatting when they look at the same page. (/var/catman is often cleared, just like a temporary directory.) )
2./var/lib
Files to be changed when the system is running normally.
3./var/local
Store variable data for programs installed in/usr/local (that is, programs installed by your system administrator). Note that if necessary, even locally installed programs will use other/var directories, such as/var/lock.
4./var/lock
Lock the file. Many programs follow conventions that produce a locked file in/var/lock to support them in using a particular device or file. When other programs notice this locked file, they don't use the device or the text
Thing
5./var/log
Various procedures of the log (L o g) documents, in particular login (/var/log/wtmp log records all to the system login and logoff) and Syslog (/var/log/messages Records store all core and System program information). Documents in/var/log often grow in an indefinite manner and should be cleared regularly.
6./var/run
Save the information file about the system that is valid before the next system boot. For example,/var/run/utmp contains information about the user who is currently logged on.
7./var/spool
A directory where the spool (s P o L) program is placed, such as M a I, n e w s, print queues, and other queue jobs. Each of the different s P o L has its own subdirectory under/var/spool, for example, the user's mailbox is stored in the/var/spool/mail.
8./var/tmp
More than/TMP allows for a larger or more temporary file that requires a longer period of time. Note that the system administrator may not allow/var/tmp to have very old files.

/proc File system
The/proc file system is a pseudo file system, which means that it is a directory that does not actually exist, so this is a very special directory. It does not exist on a disk, but is generated by the core in memory. This directory is used to mention
For information about the system. The following describes some of the most important files and directories (the/proc file system is described in more detail in the proc man page).
1./proc/x
An information directory about process X, which is the identification number of this process. Each process has a directory named its own process number under/Proc.
2./proc/cpuinfo
Information about the processor (C p u), such as the type of C p u, manufacturer, model, and performance.
3./proc/devices
A list of device drivers for the currently running core configuration.
4./PROC/DMA
Displays the currently used D M a channel.
5./proc/filesystems
File system information for the core configuration.
6./proc/interrupts
Displays the information about the interrupted information and occupants, as well as the number of people being occupied.
7./proc/ioports
The I/O port that is currently in use.
8./proc/kcore
System physical memory image. It is exactly the same size as physical memory, but it does not actually occupy so much memory; it is created only when the program accesses it. (Note: Unless you copy it to somewhere else,/proc does not have any
Things occupy any disk space. )
9./proc/kmsg
The message for the core output. will also be sent to S Y S l o G.
/proc/ksyms
The core symbol table.
/proc/loadavg.
System "average load"; 3 meaningless indicators indicate the current workload of the system.
/proc/meminfo
Various memory usage information, including physical memory and swap partitions (s w a P).
/proc/modules
Store which core module information is currently loaded.
/proc/net
Network protocol status information.
/proc/self
A symbolic connection to the process directory of a program that views/proc. When 2 processes view/proc, this will be a different connection. This mainly facilitates the program to get its own process directory.
/proc/stat
The different states of the system, such as the number of times the page has been incorrectly launched after the system started.
/proc/uptime
The length of time the system started.
/proc/version
Core version.

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.