Structure and usage of folders in Linux

Source: Internet
Author: User
Tags temporary file storage
Structure and usage of folders in Linux:

/Bin binary executable command
/Dev special file
/ETC system management and configuration file
Configuration files and scripts started by/etc/rc. d
The base point of the/home user's home directory. For example, if the user's home directory is/home/user, you can use ~ User
/Lib Standard Program The design library, also known as the dynamic link shared library, works similar to the. dll file in windows.
/Sbin system management command, which stores the management program used by the system administrator.
/Tmp public temporary file storage point
/Root system administrator's home directory (haha, privileged class)
/The MNT system provides this directory for users to temporarily Mount other file systems.
The/lost + found directory is usually empty, and the system shuts down abnormally, leaving the "Homeless" file (what is. Chk in Windows) here
/Proc virtual directory, which is the ing of system memory. You can directly access this directory to obtain system information.
/Var overflow of some large files, such as log files of various services
The/usr directory contains almost all the applications and files to be used. Including:
/Usr/x11r6 directory for storing X Windows
/Usr/bin numerous applications
/Usr/sbin hyperuser Management Program
/Usr/DOC Linux document
Header files required for developing and compiling applications in/usr/include Linux
/Usr/lib common dynamic link library and software package configuration file
/Usr/man help document
/Usr/src Source code , Linux kernel source Code Put it in/usr/src/Linux.
/Usr/local/bin commands added locally
/Usr/local/lib: local root file system added

Generally, the root file system occupies less space, because most of the files do not need
Regular changes, including strict files and a small, infrequently changed file system, are not prone to damage.
Except for a possible/v m l I n u Z standard system boot image, the root directory generally does not contain any files. All
Other files are in the subdirectory of the root file system.
1./bin directory
The/B I n directory contains commands required for boot or commands that common users may use (possibly after boot ). These
Commands are executable programs of binary files (B I n is short for B I n a R Y--binary). Most of them 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 the files are used by the system administrator
The basic system program is used, so although common users can use it when necessary and allowed, it is generally not used by common users.
3./etc directory
The/e t c directory stores various system configuration files, including the user information file/e t C/p a s w d, the system initialization file
Parts/e t C/r c. L I n u x is exactly * These files can run normally.
4./root directory
The/root directory is the root user directory.
5./lib directory
/L the I B directory is the shared library required by the Program on the root file system. It stores the shared files required by the root file system program.
. These files contain code that can be shared by many programs, so that every program contains sub-programs with the same subroutine
Therefore, the executable file can be smaller and save space.
6./lib/modules directory
The/lib/modules directory contains the system core which can be loaded with various modules, especially when the damaged system is restored.
Modules required by the system (such as network and file system drivers ).
7./dev directory
The/d e v directory stores the device files, that is, the device driver. You can use these files to access external devices. For example
Users 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 information and data generated by the program during runtime. However, after boot, it is best to run the program
/V a r/T m p to replace/tmp, because the former may have a larger disk space.
9./boot directory
The/B o t directory stores the files used by the bootstrap loader, such as l I L O, and the core image is often stored here,
Instead of in the root directory. However, if there are many core images, this directory may become very large.
The file system will be better. Note that the core image must be in the first 1 0 2 4 cylinder of the I d e hard drive.
10./mnt directory
The/m n t directory is the installation point for the temporary installation (m o u n t) File System by the system administrator. The program does not automatically support installation
/MNT. /Mnt can be divided into many sub-directories. For example,/mnt/Dosa may be a soft drive using the m s d o s file system,
The/mnt/exta may be a soft drive using the e x T 2 file system, or a/mnt/CDROM Optical Drive.
11./proc,/usr,/var,/Home Directory
Other File System installation points.

The following is a detailed description;

/Etc File System
The/etc directory contains various system configuration files, which are described below. Others, You should know which one they belong.
Program, and read the m a n page of the program. 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 start or change at the running level.
2./etc/passwd
User database, where the domain provides the user name, real name, user start directory, encrypted password and user's
His information.
3./etc/fdprm
Floppy Disk parameter table to describe different floppy disk formats. Setfdprm can be used for setting. For more information, see s e t f d p r m.
.
4./etc/fstab
Specifies the list of file systems to be automatically installed at startup. It also contains information about the s w a p zone enabled with Swapon-.
5./etc/group
Similar to/etc/passwd, but not user information but group information. Including various data of the group.
6./etc/inittab
Init configuration file.
7./etc/issue
Including the user's output before the logon prompt. It usually includes a short description or welcome information of the system. Content
Determined by the system administrator.
8./etc/magic
"F I l e" configuration file. Contains descriptions of different file formats. "f I l e" is based on the file type.
9./etc/motd
M o t d is short for message of the day, which is automatically output after the user logs on successfully. The content is determined by the system administrator.
It is often used for notification information, such as warning about the scheduled shutdown time.
10./etc/mtab
List of currently installed file systems. Initiated by the script (s c r I t p) and automatically updated by the mount command. When one
List of currently installed file systems (such as the DF command ).
11./etc/shadow
The shadow password file on the system where the shadow (s h a d o W) password software is installed. The shadow password file will be/e t C/P A S W D
The encrypted password in the file is moved to/e t C/s h a d o W, which is only readable to the Super User (R o t. This makes deciphering passwords more difficult.
To increase the security of the system.
12./etc/login. defs
L o g I n command configuration file.
13./etc/printcap
Similar to/etc/termcap, but for printers. Different syntaxes.
14./etc/profile,/e t C/c s h. l o g I n,/etc/CSH. cshrc
Files executed by B o u r n e or C shells at login or startup. This allows the system administrator to create a global default environment for all users.
15./etc/securetty
Confirm the security terminal, that is, the terminal that allows the Super User (R o t) to log on. Generally, only the virtual console is listed.
It may (at least difficult) Break into the system through a modem (m o d e m) or network and get super user privileges.
16./etc/shells
List the available s h e l. The CHSH command allows you to change the logon s h e l within the range specified in this file. Provide 1
F t p service process ftpd checks whether user s h e l is listed in the/etc/shells file. If not
This user is allowed to log on.
17./etc/termcap
Terminal performance database. Describes the escape sequence used by different terminals. Escape is not output directly when writing a program.
Sequence (this can only work on terminals of a specific brand), but searches for the correct sequence of work to be done from/etc/termcap.
In this way, most programs can run on most terminals.

/Dev File System
The/dev directory contains the device files of all devices. Device Files are named according to specific conventions, which are described in the device list.
The device files are generated by the system during installation and can be described in/dev/makedev later. /D e v/m a k e d e v. Local is
The description document written by the system administrator for the local device file (or connection) (for example, some non-standard device drivers are not standard
Makedev ). The following describes some common files in/d e v.
1./dev/console
The system console, that is, the monitor that connects directly to the system.
2./dev/HD
I d e hard drive interface. For example,/d e v/h d A refers to the first hard disk, and h a D 1 refers to the first disk of/d e v/h d.
Partition. If there are other hard disks in the system, they are/d e v/h d B,/d e v/H D C ,......; if multiple partitions exist
H d A 1, h d a 2 ......
3./dev/SD
S c s I Disk Driver Interface. If the system has a s c s I hard disk, it will not access/d e v/h a D, but/d e v/s d.
4./dev/FD
The driver of the drive. For example,/d e V/f d 0 indicates the first floppy disk of the system, which is usually referred to as a: disk,
/D e V/f d 1 refers to the second floppy disk ,...... the/d e V/f d 1 H 1 4 4 0 indicates accessing 4 in drive 1. 5 high-density disks.
5./dev/ST
S c s I tape drive driver.
6./dev/tty
Supports the virtual console. For example,/d e v/t y 1 indicates the first virtual console of the system, and/d e v/t y 2 indicates the system.
The second virtual console.
7./dev/Pty
Supports remote logon to pseudo terminals. You must use the/d e v/p t y device when logging on to te l n e t.
8./dev/TTYs
The computer serial interface is the "c o m 1" port for d o s.
9./dev/CUA
Computer serial interface, a device used with a modem.
10./dev/null
"Black hole", all information written to this device will disappear. For example, to hide the output information on the screen
You only need to input the output information to/d e v/n u L.

/Usr File System
/Usr is a very important directory. Usually this file system is large because all programs are installed here. /Usr
All files are generally from the L I n u x release (d I s t r I B u t I o n); locally installed programs and other things are under/usr/local, in this way, you do not need to re-install all programs when upgrading the new system or new release. Many contents in the/usr directory are:
Optional, but these functions make the user use the system more effective. /U s r can accommodate many large software packages and Their Configurations
File. Some important directories are listed below (some less important directories are omitted ).
1./usr/x11r6
Contains all executable programs, configuration files, and support files for the X wi n o W system. To simplify the development and installation of X,
X files are not integrated into the system. X wi n d o W system is a powerful graphics environment that provides a large number of graphics
Tool program. If you are familiar with Microsoft wi n d o w s or m a c h I n o s h, you will not feel helpless about x wi n d o W system.
2./usr/x386
Similar to/u s r/X 11r6, but it is dedicated to x 11 Release 5.
3./usr/bin
A collection of almost all user commands is a software library of the system. Some other commands are in/bin or/usr/local/bin.
4./usr/sbin
Includes unnecessary system management commands 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 manual pages, G n u information documents, and various other document files. Section of each online manual"
There are two sub-directories. For example,/u s r/m a n 1 contains the source code of section 1 of the online manual (no formatted Original Text
,/U s r/m a n/c a t 1 contains the first formatted content. L The online manual is divided into the following nine sections: Internal commands, system calls
Usage, library functions, devices, file formats, games, macro software packages, system management, and core programs.
6./usr/include
Contains C Language These files end with. h and are used to describe the data structure used in C language programs,
Sub-processes and constants. In order to maintain consistency, this should be put under/usr/lib, but this name has always been used.
Word.
7./usr/lib
Contains unchanged data files of programs or subsystems, including some s I t e-w I d e configuration files. Name l I B comes from library
(Library); the original library for programming also exists in/usr/lib. When you compile a program, the program will be connected to the library. Also
Many programs store configuration files.
8./usr/local
Install the software and other files locally. This is similar to/u s r. The user may find some relatively large
Such as t e x and e m a c s.

/Var file system
/Var contains the data to be changed during normal operation of the system. The directory size of the data is usually changed.
Or extended. The original/v a r directory contains some content in/u s r, but to maintain the relative stability of the/u s r directory
Put some directories that need to be changed frequently in/v a r. Each system is specific, that is, it is not shared with other computers through the network.
Some important directories are listed below (some less important directories are omitted ).
1./var/catman
Contains the formatted help (m a n) page. The source files on the Help Page usually exist in/u s r/m a n/m a n; some m a n pages
A pre-formatted version may exist in/u s r/m a n/C a T. Other m a n pages must be formatted for the first time,
The formatted version exists in/var/man, so that other users do not have to wait for formatting to view the same page.
(/Var/catman is often cleared, just like clearing a temporary directory .)
2./var/lib
Stores the files to be changed when the system is running normally.
3./var/local
Store variable data of programs installed in/usr/local (that is, programs installed by the system administrator ). Note: if necessary,
Other/var directories, such as/var/lock, are used even for locally installed programs.
4./var/lock
Lock the file. Many programs follow the Convention of generating a locked file in/var/lock to support
Use a specific device or file. When other programs notice this locked file, they will no longer use this device or file
.
5./var/log
Logs of various programs (l o g), especially login (/var/log/wtmp log records all logon and note to the System
Sales) and syslog (/var/log/messages records all core and system program information ). Files in/var/log are often not
Fixed growth, should be cleared regularly.
6./var/run
Save the system information files that are valid before the next system boot. For example,/var/run/utmp contains the current Login
User information.
7./var/spool
Directory of the "S p o l" program, such as the directory where m a I L, N E W S, print queue and other queues work. Each
Different s p o l files have their own subdirectories under/var/spool. For example, users' mailboxes are stored in/var/spool/mail.
8./var/tmp
A temporary file that is larger than/tmp or needs to exist for a long time.
Note that the system administrator may not allow/var/tmp to have very old files.

/Proc file system
/Proc file system is a pseudo file system, that is, 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 the memory. This directory is used to extract
For information about the system. The following describes some of the most important files and directories (/proc file system has more details on the proc man page
).
1./proc/x
The information directory of process X indicates the ID of the process. Each process has
The Directory of the current process number.
2./proc/cpuinfo
Stores information about the processor (c p u), such as the type, manufacturer, model, and performance of the c p u.
3./proc/devices
List of device drivers of the core configurations currently running.
4./proc/DMA
Displays the currently used D m a channel.
5./proc/filesystems
The file system information of the core configuration.
6./proc/interrupts
Displays the information of the interrupted and occupied users, and the number of occupied users.
7./proc/ioports
The currently used I/O port.
8./proc/kcore
System physical memory image. It is the same as the physical memory size, but it does not actually occupy so much memory; it only
It is created only when a program accesses it. (Note: Unless you copy it to somewhere, there is no
Things occupy any disk space .)
9./proc/kmsg
Core Output Message. It will also be sent to s y s l o g.
10./proc/ksyms
Core symbol table.
11./proc/loadavg
System "average load"; three meaningless indicators indicate the current workload of the system.
12./proc/meminfo
Various memory usage information, including physical memory and swap partition (s w a p ).
13./proc/modules
Stores information about the core modules currently loaded.
14./proc/Net
Network Protocol status information.
15./proc/self
Stores the symbolic connection to the process directory of the program to view/proc. This will be different when two processes view/proc
. This allows the program to obtain its own process directory.
16./proc/STAT
Different States of the system, such as the number of page errors after the system is started.
17./proc/uptime
The duration of system startup.
18./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.