Linux Standard directory structure

Source: Internet
Author: User
Tags set time system log

Linux directory Structure

/:root directory, the general root directory, only the 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:Put some files that were used when the Linux system was started. /boot/vmlinuz is the kernel file for Linux, as well as/boot/gurb. Recommended separate partition, partition size 100M
/dev:Storing the device files under the Linux system and accessing a file in that directory is 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 is not recommended to store executable files in this directory, 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:System Default User home directory, add user account, 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, needs to call some additional parameters when the function library assists, the more important directory is/lib/modules.
/lost+fount:When a system exception generates an error, 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-ROM 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 of data are in memory, such as the system core, external devices, 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:The system administrator root home directory, the system first boot partition is/, so it is best to put/root and//place 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:Data directories that need to be accessed after the service is started, such as the Web page data that the WWW service needs to store within/SRV/WWW
/usr:Application Storage Directory,/usr/binStore applications,/usr/shareStore shared data,/usr/libStorage cannot be run directly, but it is necessary for many programs to run some library files. /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 system execution, such as log files that change at any time/var/log,/var/log/message:All login files are stored in the directory,/var/spool/mail:The directory where the mail is stored,/var/run:Program or service startup

, its pid is stored in the directory. It is recommended to separate partitions to set large disk space

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

/dev:Catalogue
DEV is the acronym for Devices. /dev This directory is important to all users. Because this directory contains all the external devices used in the Linux system. But here is not the driver for the external device, this and

Windows,dos operating system is not the same. It is actually a port that accesses these external devices. We can easily access these external devices, and access a file without any difference in a directory.

Linux inherits the Unix style, recognizing all devices as a file.

There are two types of device files: Block device file (b) and character device file (c)

The device files are generally stored in the/dev directory, and the common device files are described as follows:

/dev/hd[a-t]:ide Equipment

/DEV/SD[A-Z]:SCSI Equipment

/DEV/FD[0-7]: Standard floppy drive

/DEV/MD[0-31]: Soft RAID device

/DEV/LOOP[0-7]: Local loopback device

/DEV/RAM[0-15]: Memory

/dev/null: Unlimited data reception device, equivalent to black hole

/dev/zero: Unlimited 0 Resources

/DEV/TTY[0-63]: Virtual terminal

/DEV/TTYS[0-3]: Serial port

/DEV/LP[0-3]: the same port

/dev/console: Control Console

/dev/fb[0-31]:framebuffer

/dev/cdrom =/dev/hdc

/dev/modem =/dev/ttys[0-9]

/dev/pilot =/dev/ttys[0-9]

/dev/random: Random number devices

/dev/urandom: Random number devices

(PS: Random number device, I will write a blog after the summary)

How are the nodes in the/dev directory created?

DEVF or Udev will automatically create it for you.

Kobject is the foundation of the Sysfs file system, and Udev acquires newly created devices by monitoring and detecting SYSFS.

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

/etc: Directory
Contains many files. Many network configuration files are also in/etc.
/ETC/RC or/etc/rc.d or/etc/rc*.dThe directory of scripts or scripts that is running when the run level is started, or changed.
/etc/passwd
User database, where the domain gives the user name, real name, home directory, encrypted password, and other information of the user.
/etc/fstab
A list of file systems that automatically mount the mount-a command (in/ETC/RC or equivalent startup file) at startup. Linux, also includes information about the swap area enabled with SWAPON-A.
/etc/group
Similar to/etc/passwd, but not the user but the group.
/etc/inittab
The configuration file for init.
/etc/issue
Getty the output information before the logon prompt. Usually includes a short description of the system or welcome information. The content is determined by the system administrator.
/ETC/MOTD
Message of the day, automatic output after successful login. The content is determined by the system administrator. Often used to advertise information, such as a warning to schedule shutdown time.
/etc/mtab
List of currently installed file systems. Initialized by scripts and updated automatically by the Mount command. A list of currently installed file systems is required, such as the DF command.
/etc/shadow
The shadow password file on the system on which the shadow password software is installed. The shadow password file moves the encrypted password in the/etc/passwd file to/etc/shadow, which is only readable by the root. This makes it more difficult to decipher the password.
/etc/login.defs
The configuration file for the login command.
/etc/printcap
Similar to/etc/termcap, but for printers. syntax is different.
/etc/profile,/etc/csh.login,/ETC/CSH.CSHRC
The file that is executed by Bourne or C shells at logon or startup. This allows the system administrator to establish a global default environment for all users.
/etc/securetty
Confirm the security terminal, that is, which terminal allows root login. Typically only virtual consoles are listed, which makes it impossible (at least difficult) to break into the system via modem or network and gain superuser privileges.
/etc/shells
The list of trusted SHELL.CHSH commands allows the user to change the login shell within the scope specified in this file. Provides a service process for a machine FTP service FTPD checks whether the user shell is listed in the/etc/shells file, if the user is not allowed to log on.
/etc/sysconfig
Network Configuration Related Directory

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

/proc: Directory

File Name files Contents
/proc/cmdlineThe relevant parameters released when loading kernel! Check out this file to see how the system started!
/proc/cpuinfoInformation about the CPU of this machine, including the time pulse, type and arithmetic function, etc.
/proc/devicesThis document records the main device code for each major device in the system, which is related to Mknod.
/proc/filesystemsCurrently the system has been loaded by the file system ROM!
/proc/interruptsCurrent IRQ assignment status above the system.
/proc/ioportsThe I/O addresses configured on each of the devices above the current system.
/proc/kcoreThis is the size of the memory! It's so big, right? But don't read him!
/proc/loadavgDo you remember top and uptime? That's right! The top three average values are recorded here!
/proc/meminfoUse free to list the memory information, hehe! You can also check it here!
/proc/modulesCurrently our Linux has loaded the list of modules can also be thought of as a driver!
/proc/mountsThe data that has been mounted by the system is the data that is called with the Mount command!
/proc/swapsWhat is the memory where the system hangs and loads? Oh! The use of the partition is recorded here!
/proc/partitionsUsing Fdisk-l will show all the partition right now? There is also a record in this document Oh!
/proc/pciOn the PCI bus top, the details of each device! Lspci can be used to check!
/proc/uptimeis to use uptime time, will appear the information!
/proc/versionThe core version is the content displayed with Uname-a!
/proc/bus/*Some bus-line devices, as well as a U disk device is also recorded here Oh!

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

/usr: directory
The/usr file system is often large because all programs are installed here. All files in/usr typically come from Linux distribution, locally installed programs, and other things under/usr/local. This may not require reinstalling all programs when upgrading a new system or distribution.
/usr/etcStoring settings files
/usr/gamesStore games and teaching documents
/usr/includeThe header file that holds the C development tool
/usr/shareStoring structure-independent data
/usr/bin
Almost all user commands. Some commands are in/bin or/usr/local/bin.
/usr/sbin
Root file system unnecessary system administration commands, such as most service programs.
/usr/share/man,/usr/share/info,/usr/share/doc
Manual pages, GNU information documents, and various other documentation files.
/usr/include
The header file for the C programming language. In order to be consistent this should actually be under/usr/lib, but it is traditionally supported by this name.
/usr/lib
An unchanging data file for a program or subsystem, including some site-wide configuration files. The name Lib originates from the library; The original inventory of the programming is in/usr/lib.
/usr/local
Locally installed software and other files are placed here.
/usr/srcSource code of the stored program


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

/var: directory
/var includes data to be changed when the system is generally running. Each system is specific, i.e. it is not shared with other computers over the network.
/var/catman
The source file of the Cache.man page of the man page when the format is required is generally present in/usr/man/man*; some man pages may have a pre-formatted version in/usr/man/cat*. While the other man pages need to be formatted for the first time, the formatted version exists/ Var/man, so that other people look at the same page without having to wait for formatting. (/var/catman are often cleared, just as the temporary directory is cleared.)
/var/lib
The file to be changed when the system is running normally.
/var/local
Variable data for programs installed in/usr/local (that is, programs installed by the system administrator). Note that if necessary, even locally installed programs use other/var directories, such as/var/lock.
/var/lock
Lock the file. Many programs follow the convention of creating a locked file in/var/lock to support their use of a particular device or file. Other programs Note that this lock file will not attempt to use this device or file.
/var/log

Log files for various programs, in particular login (/var/log/wtmp log all to system log-in and logoff) and syslog (/var/log/messages store all core and System program information.) The files in the/var/log are constantly growing in uncertainty, Should be cleaned up regularly.
/var/run

The information file that is valid for the system before the next boot. For example,/var/run/utmp contains information about the user who is currently logged on.
/var/spool
Directories for mail, news, print queues, and other queues. Each of the different spool has its own subdirectory under/var/spool, for example, the user's mailbox is in/var/spool/mail.
/var/tmp

Temporary files that are larger or need to exist longer than/tmp. (Although the system administrator may not allow/var/tmp to have very old files.)


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


More important Catalogs

In a Linux system, there are several directories that are particularly important to note, and the following are some of the directories that need to be noted, as well as the use of presets:
/etc:This directory is very important, as mentioned above, your boot and system data files are in this directory, so when this directory is destroyed, then your system probably almost the hell off! In the later files, you will find that we often use the/ETC/RC.D/INIT.D subdirectory under this directory, because this INIT.D subdirectory is the place to open some Linux system services scripts (which can be thought of as a batch file). And in the/etc/rc.d/rc.local this file is the boot-up execution.
/bin,/sbin,/usr/bin,/usr/sbin:This is the system preset execution file placement directory, such as root often used in userconf, netconf, Perl, GCC, C + + and so on the data are placed in these directories, so if you can not find the prompt character under a file, in these four directories to look up! Among them,/bin,/usr/bin is to the system user to use the instruction, and/sbin,/usr/sbin is to the system administrator to use the instruction!
/usr/local:This is the system preset directory that lets you install the suite you upgraded later. For example, when you find that an updated Web suite (such as Apache) can be installed and you don't want to upgrade your suite in RPM, you can install the Apache suite under/usr/local. Installation here has a benefit, because at present everyone's system is similar, so if your system to let others take over, it is more easy to get started! It is also easier to find the data Oh! So, if you need it, I usually add/usr/local/bin to my path.
/home:This is where the system will have the home directory settings for the population of the account.
/var:This path is important! Whether it is logging in, the records of various services issues, and the usual record of service records, so when your system has a problem, you need to check the file data in this directory to see where the problem is! and Mail's preset placement is here too, so he's very important
/usr/share/man,/usr/local/man:These two directories are places where you can place all kinds of kit documentation, for example, if you execute man man, the system will automatically find all the documentation in both directories.


File type:


After you've finished talking about file formats, talk about the types of files you can call. The first sign (d or-) can represent a directory or a file, which is a different kind of file, as we mentioned in the property introduction. The Linux file types are mainly under

These types of:
Regular files (regular file): is a generic type of file, in terms of the properties shown by Ls–al, the first property is [-]. In addition, according to the contents of the document, it can be divided into two types of documents:
Plain text file (ASCII): This is the most of the Unix system, almost as long as we can be used as a set of files belong to this kind;
Binary file (binary): usually executes the file in addition to the scripts (text-based batch file), is this kind of document format;
Directory: is the directory! The first attribute is [d];
Link: It's like a shortcut under Windows! The first property is [l];
Device: Some files that are related to the perimeter of the system are usually concentrated in the/dev directory! It is usually divided into two types:
Block device file: is some storage data to provide system access to the interface device, simply said the hard disk! For example, your hard drive code is/DEV/HDA1 and so on file! The first attribute is [b];
Character (character) device file: That is, some serial port interface devices, such as keyboard, mouse and so on! The first property is [C].


file System (inode) for Linux:
 

In the Linux system, each file contains not only the content data of the file, but also the various attributes of the file, such as: Group, user, executable,

Set time, file special attributes, and so on. We divide the contents of each file into two parts, one is the attribute of the file and the other is the content of the file.
 
To cope with these two different ext2, the inode and block are programmed to store the attributes of the file (in the Inode) and the contents of the file (placed in the block area) separately. When we are going to format a partition

When (format) is ext2, it is necessary to specify the size of the inode and block, that is, when partition is formatted as a ext2 file system, he must have inode table and block area.
 
The Block has already been mentioned earlier, and he is the smallest unit of data storage. So what is the inode?! To put it simply, Block is the area where the "file content data" is recorded, and the Inode is the record "the file's related attributes, and the file content

The information that is placed within the Block. Simply put, the inode, in addition to recording the attributes of the file, but also must have a point (pointer) function, that is, point to the file content placed in the block, so that the operating system can correctly

Get the contents of the file.

The owner and group of the file (Owner/group);
The access mode of the file;
The type of the file;
The date the file was established (CTime), the last Read time (atime), the last Modified time (mtime);
The capacity of the file;
Defines flags (flag) for file attributes, such as SetUID ... ;
The point of the real content of the file (pointer);

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.