The role of Linux folders __linux

Source: Internet
Author: User
Tags syslog temporary file storage

A. Linux directory structure

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.

In addition to a possible system boot image called/Vmlinuz standard, the root directory generally does not contain any files. All other files are in subdirectories of the root file system.

In the root directory of Linux, there are the following directories:

[Root@racnode1/]# LL

Drwxr-xr-x 2 root root 4096 10-28 21:22 bin

Drwxr-xr-x 4 root root 1024 11-10 23:17 boot

Drwxr-xr-x root root 5120 11-12 22:24 Dev

Drwxr-xr-x root root 12288 11-13 16:17 etc

Drwxr-xr-x 5 root root 4096 11-15 10:51 Home

Drwxr-xr-x root root 4096 10-28 21:22 Lib

Drwxr-xr-x 7 root root 4096 10-28 21:21 lib64

drwx------2 root root 16384 10-28 19:13 lost+found

Drwxr-xr-x 2 root root 4096 11-12 09:13 Media

Drwxr-xr-x 2 Root 0 11-12 09:13 Misc

Drwxr-xr-x 2 root root 4096 2008-08-08 mnt

Drwxr-xr-x 2 Root 0 11-12 09:13 net

Drwxr-xr-x 4 root root 4096 10-29 10:56 opt

Dr-xr-xr-x 26697 root root 0 11-12 09:10 proc

Drwxr-x---root root 4096 11-12 21:34 root

Drwxr-xr-x 2 root root 12288 11-10 23:16 sbin

Drwxr-xr-x 2 root root 4096 10-28 19:15 SELinux

Drwxr-xr-x 2 root root 4096 2008-08-08 SRV

Drwxr-xr-x root 0 11-12 09:10 sys

Drwxr-xr-x 3 root root 4096 10-28 19:25 tftpboot

DRWXRWXRWT Notoginseng root root 4096 11-19 04:03 tmp

Drwxr-xr-x 4 root oinstall 4096 11-12 09:44 u01

Drwxr-xr-x root root 4096 11-01 10:07 usr

Drwxr-xr-x root root 4096 10-28 19:30 var

[Root@racnode1/]# ls

Bin Dev Home lib64 media mnt opt root selinux sys tmp usr

Boot etc lib Lost+found misc net proc sbin srv Tftpboot u01 var

First look at the description of this directory:

(1)/bin: The/bin directory contains commands that are required to boot up or may be used by ordinary users (possibly after boot startup). These commands are binary files executable program (bin is the binary-binary abbreviation), many are important system files.

(2)/dev:/dev directory to store the device files, that is, the device driver, the user through these files to access external devices. For example, users can access the mouse input by accessing the/dev/mouse, just as they would access other files.

(3)/etc:/etc directory contains a variety of system management and configuration files, including user information file/etc/passwd, System initialization file/ETC/RC. Linux is the only way these files can run properly.

(4)/ETC/RC.D: Startup configuration files and scripts
(5)/home: Use the head of household directory, such as user's main directory is/home/user, you can use ~user Express
(6)/lib: Standard programming Library,/lib directory is a 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. Also called the dynamic Link shared library, which acts like a. dll file in Windows. 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.

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)/sbin:/sbin directory similar to/bin, 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.

(8)/tmp: Public temporary file storage point,/tmp directory store information and data generated by the program at run time. However, after boot startup, the running program is best to use/var/tmp/instead of/tmp, because the former may have a larger disk space.

(9)/root: System Administrator's home directory (privileged Class)
(a)/mnt:/mnt directory is the installation point for the system Administrator temporary installation (mount) file system. The program does not automatically support installation to/mnt. /mnt can be divided into a number of subdirectories, such as/mnt/ext may be using the Ext2 file system floppy drive,/mnt/cdrom Optical drive, and so on.

(one)/lost+found: This directory is usually empty, the system is not normal shutdown and left the "homeless" file (what is called under Windows. chk) right here.
/proc: Virtual directory, which is the mapping of system memory. You can access this directory directly to obtain system information.
(/var): Overflow areas of some large files, such as log files for various services

The/boot:/boot directory stores files used by the boot loader (bootstrap loader), such as Lilo, 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 within the first 1024 cylinders of the IDE's hard disk.

/usr: The largest catalog, the applications and files to use are almost all 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

Two. Detailed description

2.1/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. See the SETFDPRM help page for more information.

(4). /etc/fstab

Specifies the list of file systems that need to be installed automatically at startup. Also includes information about swap areas that are 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

MOTD 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.

(10). /etc/mtab

List of currently installed file systems. Initialized by scripts (script) and automatically updated by the Mount command. Used (for example, DF command) When a list of currently installed file systems is required.

(11). /etc/shadow

Shadow password file on a system with Shadow (shadow) password software installed. The shadow password file moves the encrypted password in the/etc/passwd file to/etc/shadow, which is readable only by the superuser (root). This makes it more difficult to decipher the password, thus increasing the security of the system.

(12). /etc/login.defs

The configuration file for the login command.
(13). /etc/printcap

Similar to/etc/termcap, but for printers. syntax is different.
(14). /etc/profile,/Etc/csh.login,/ETC/CSH.CSHRC
Files executed by Bourne or C shells at logon or startup. This allows the system administrator to establish a global default environment for all users.
(15). /etc/securetty
Confirm the security terminal, which Terminal allows superuser (root) 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 or network and gain superuser privileges.
(16). /etc/shells
Lists the shells that you can use. The CHSH command allows the user to change the login shell within the specified scope of this file. Provides a service process for a machine FTP service FTPD checks whether the user shell is listed in the/etc/shells file, and if not, the user is not allowed to log on.
(17). /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.

2.2/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. /dev/makedv.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 common files in/dev.

(1)./DEV/CONSOLE&NBSP
        system console, which is a monitor connected directly to the system. &NBSP
(2)./DEV/HD&NBSP
       ide The hard disk driver interface. For example:  /dev/hda refers to the first hard drive,  hda1 refers to the first partition of/devhda. If there are other hard drives in the system, then/DEV/HDB,/DEV/HDC. If there are multiple partitions, then hda1,hda2 ... &NBSP
(3)./DEV/SD&NBSP
       SCSI the disk driver interface. If the system has a SCSI hard drive, the/DEV/HDA will not be accessed and the/DEV/SDA.&NBSP
(4)./DEV/FD&NBSP
         Floppy device driver. For example:/dev/fd0 refers to the system's first floppy disk, which is usually said a: disk,  /dev/fd1 refers to the second floppy disk, ... /dev/fd1h1440, however, represents access to 4 of drive 1. 5 High density disk. &NBSP
(5)./DEV/ST&NBSP
       scsi the tape drive driver. &NBSP
(6)./DEV/TTY&NBSP
        provides Virtual Console support. For example:/dev/tty1 refers to the system's first Virtual Console, and  /dev/tty2 is the second Virtual Console of the system. &NBSP
(7)./DEV/PTY&NBSP
        provides remote login pseudo terminal support. The/dev/pty device is used when Telnet is logged in.

(8). /dev/ttys
Computer serial interface, for DOS is "COM1" mouth.
(9). /dev/cua
A computer serial interface, a device used with a modem.
(10). /dev/null
"Black hole", all information written to the device will disappear. For example, when you want to hide the output information from the screen, simply enter the output into the/dev/null.

2.3/USR File System
/usr is a very important directory, usually a large file system, because all programs are installed here. All files in/usr are typically from the Linux distribution (distribution), locally installed programs and other things under/usr/local, because this allows you to upgrade your new system or release without having to reinstall the entire program. Many of the contents of the/usr directory are optional, but these features make it more efficient for users to use the system.

/usr accommodates many large packages and their configuration files. Some important directories are listed below:

(1). /usr/x11r6
Contains all executable programs, configuration files, and supporting files for the X Window System. To simplify X's development and installation, X's files are not integrated into the system. The X Window System is a powerful graphical environment that provides a large number of graphical tool programs. Users who are more familiar with Microsoft Windows or Machintosh will not be able to feel helpless with the X Windows System.
(2). /usr/x386
Similar to/usr/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,/usr/info,/usr/doc
These directories contain all the man pages, GNU information documents, and various other document files. The section of each online manual has two subdirectories. For example:/usr/man/man1 contains the source code (not formatted original file) in the first section of the online manual,/USR/MAN/CAT1 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 the/usr/lib, but it has always been used in this name.
(7). /usr/lib
Contains unchanging data files for a program or subsystem, including some site-wide configuration files. The name Lib originates 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/usr. Users may find some larger packages here, such as Tex,emacs.

2.4/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. Some of the content in the/var directory is in/usr, but in order to keep the/usr directory relatively stable, the directories that need to be changed frequently are put into/var. Each system is specific, that is, not shared with other computers over the network.

Some important directories are listed below:

(1). /var/catman
Includes the formatted Help (man) page. The source files for the help page are generally in/usr/man/man, and some man pages may have preformatted versions that exist in/usr/man/cat. While the other man 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. This device or file is no longer used by other programs when they notice this locked file.
(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 that places the spool (spool) program, such as Mail,news, print queues, and other queue work. Each different spool 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.

2.5/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 provide 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 that holds the processor (CPU), such as the type of CPU, 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 somewhere, there is nothing in/proc that takes up any disk space.) )
(9). /proc/kmsg
The message for the core output. will also be sent to Syslog.
(10). /proc/ksyms
The core symbol table.
(11). /proc/loadavg
System "average load"; 3 meaningless indicators indicate the current workload of the system.
(12). /proc/meminfo
Various memory usage information, including physical memory and swap partitions (swap).
(13). /proc/modules
Store which core module information is currently loaded.
(14). /proc/net
Network protocol status information.
(15). /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.
(16). /proc/stat
The different states of the system, such as the number of times the page has been incorrectly launched after the system started.
(17). /proc/uptime
The length of time the system started.
(18). /proc/version
Core version.

Sorting from Network

------------------------------------------------------------------------------

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.