This chapter describes an important part of the standard Linux directory tree, based on FSSTND file system standards. Outlines a general approach to dividing a directory tree into several separate file systems for different purposes and given requirements. Some other methods are also explained.
Background
Loosely based on the Linux file system standard FSSTND version 1.2 (see bibliography [Qui95]), this chapter is intended to establish a standard for how to organize a Linux system tree. Such a standard is easy to write or port (porting?) Linux software, the advantages of managing Linux systems, because everything will be in their usual place. This standard does not enforce authority for everyone to comply, but it has the most Linux distributions support. Failure to comply with FSSTND is not a good idea if there are no special reasons. Fsstnd is intent on complying with the UNIX legacy and current trends, making it easier for people familiar with other Unix systems to accept Linux systems (and vice versa).
This chapter is not as detailed as fsstnd. A system administrator should read the fsstnd to get a full understanding.
This chapter does not explain all the files in detail. The intention is not to describe each file, but to give an overview of the system from the perspective of the file system. More information on each file is in this manual or elsewhere in the man page.
The intent is to divide the entire tree into smaller portions, each of which can be on its own disk or partition, to accommodate disk capacity and easy to backup and other system management. The main sections are the root,/usr,/var, and/home file systems. Each part has a different purpose. The directory tree has been designed to work well on the Linux machine's network, and can share parts of the file system over a read-only device such as CDROM or an NFS network.
The tasks for different parts of the tree are described below.
Each machine has a root file system (typically on a local disk or in a RAM disk or network disk) that contains the files necessary to boot the system and enable other filesystems to mount, and the root file system should have enough content to have a single user state. You should also include tools to repair damaged systems, restore backups, and more.
The/usr file system contains all the unchanged files required in all commands, libraries, man pages, and other general operations. /usr should not have a specific file for a given machine, nor should there be any files to be modified in general use. This allows files in this file system to be shared over the network. This can be more effective because it saves disk space (/usr is easily hundreds of megabytes) and is easy to manage (when upgrading applications, only master/usr needs to change without changing each machine) even if the file system is on a local disk, You can also read only the mount to reduce file system corruption when the system crashes.
The/var file system contains files that will change, such as the Spool directory (mail, news, printer, etc.), log files, formatted manual pages, and staging files. Everything that has traditionally been/var has been somewhere under/usr, but so/usr cannot be read-only installed.
The/home file system contains the user's home directory, which is all the actual data on the system. The home directory is easily backed up in its own directory tree or file system, and other parts are often not backed up, at least without frequent backups (they rarely change). A large/home may be divided into a number of file systems, the need to add a level of/home under the name, such as/home/students,/home/staff and so on.
Although the different parts of the above are called file systems, they do not have to be really separate file systems. If the system is a small single-user system, and the user wants to simplify, it can be easily placed in a file system. Depending on the disk capacity and the space allocated for different purposes, the directory tree can also be divided into different file systems. It is important to use standard names, even if/var and/usr are on the same partition, names/USR/LIB/LIBC.A and/var/adm/messages must be able to work, such as moving files under/var to/usr/var and/var as/usr/var The symbolic connection.
The UNIX file structure groups files by purpose, that is, all commands are in one place, all the data is in another place, all documents are in one place, and so on. Another method is to group the file according to the program belonging to it, that is, all Emacs files in one directory, all Tex files in the other, and so on. The problem with the latter approach is that files are difficult to share (the program directory often contains both statically shareable and dynamically unshared files) and sometimes difficult to find (such as a man page in a large number of places, making it extremely difficult for the man program to find them).
Root file system
The root file system should generally be relatively small, since including strict files and a small infrequently changing file system is not susceptible to damage. A corrupted root file system generally means that the risk should not be taken unless the system fails to boot in a specific way, such as from a floppy disk.
The root directory generally does not contain any files, except for the possible standard system-guided mappings, usually called/vmlinuz. All other files are in subdirectories of the root file system.
/bin
The command that is required to boot up or the command that a normal user might use (possibly after boot startup).
/sbin
Similar to/bin, but not for ordinary users, although available if necessary and allowed.
/etc
A configuration file for a particular machine.
/root
The home directory of the root user.
/lib
The shared library required by the program on the root file system.
/lib/modules
Core loadable modules, especially those needed to boot when a damaged system is restored (for example, network and file system drivers).
/dev
Device files.
/tmp
Temporary files. Programs that run after boot startup should use/VAR/TMP instead of/TMP because the former may be on a disk that has more space.
/boot
A file used by the boot loader (bootstrap loader), such as Lilo. Core mappings are also often here, not in the root directory. If there are many core images, this directory can become very large, then it may be better to use a separate file system. Another reason is to make sure that the core image must be within the first 1024 cylinders of the IDE's hard disk.
/mnt
The installation point for the system administrator to mount temporarily. The program does not automatically support installation to/mnt. /mnt can be categorized as subdirectories (for example,/mnt/dosa may be a floppy drive using the Msdos file system, and/mnt/exta may be using the Ext2 file system's floppy drive).
/proc, USR,/var,/home
Installation points for other file systems.
/ETC Directory
The/etc directory contains many files. Some of these are described below. Other you should know which program they belong to and read the man page of the program. Many network profiles are also in/etc, which are described in the Network Administration Guide.
/ETC/RC OR/ETC/RC.D OR/ETC/RC.D
To start, or change the directory of the scripts or scripts running at run level, see the chapter on init for more detailed information.
/etc/passwd
User database, where the domain gives the username, real name, home directory, encrypted password, and other information about the user. Format See passwd's man page.
/etc/fdprm
The floppy disk parameter table. Describes the different floppy disk formats. Set with SETFDPRM. See SETFDPRM's man page for more information.
/etc/fstab
A list of file systems that are automatically mount at startup mount-a command (in/ETC/RC or equivalent startup files). Linux also includes information about swap areas that are enabled with SWAPON-A. See section 4.8.5 and the man page of Mount.
/etc/group
Similar to/etc/passwd, but not the user but the group. See Group's man page.
/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 a welcome message. The content is determined by the system administrator.
/etc/magic
The configuration file for the file. Contains a description of the different file formats, based on which file types are guessed. See Magic and file's man page.
/etc/motd
Message of the ' Day ' is automatically exported after successful login. The content is determined by the system administrator. Often used to advertise information, such as a warning about scheduled shutdown times.
/etc/mtab
List of currently installed file systems. Initialized by scripts and automatically updated by the Mount command. Used when a list of currently installed file systems is needed, such as the DF command.
/etc/shadow
Shadow password file on a system with shadow password software installed. The shadow password file moves the encrypted password in the/etc/passwd file to the/etc/shadow, which is only readable for root. This makes deciphering the password more difficult.
/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
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. The Shell see man page.
/etc/securetty
Confirm the security terminal, which terminal allows root login. Typically, only the virtual Console is listed, which makes it impossible (at least difficult) to break into the system through a modem or network and gain superuser privileges.
/etc/shells
Lists the trusted shells. 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.
/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. See the man page of Termcap, Curs_termcap and Terminfo.
/dev Directory
The/dev directory includes device files for all devices. The device file is named with a specific contract, as described in the device list (see [Anv]). The device file is generated during installation and can be described later with/dev/makedev. /dev/makedev.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).
/usr file system
The/usr file system is often large because all programs are installed here. All files in/usr are typically from Linux distribution, locally installed programs and other things under/usr/local. This may not require you to reinstall all programs when upgrading a new system or distribution. Some subdirectories of/usr are listed below (some of the less important directories are omitted, see fsstnd for more information).
/usr/x11r6
All files of the X window System. To simplify X's development and installation, X's files are not integrated into the system. X himself under/usr/x11r6 similar to/usr.
/usr/x386
Similar to/USR/X11R6, but for X11 release 5.
/usr/bin
Almost all user commands. Some commands are in/bin or/usr/local/bin.
/usr/sbin
Root file systems are unnecessary system administration commands, such as most service programs.
/usr/man,/usr/info,/usr/doc
Man pages, GNU information documents, and various other document files.
/usr/include
The header file for the C programming language. For consistency this should actually be under/usr/lib, but it is traditionally supported by this name.
/usr/lib
The unchanging data file of a program or subsystem, including some site-wide configuration files. The name Lib originates from the library. The original inventory of programming is in/usr/lib.
/usr/local
Locally installed software and other files are placed here.
/var File System
/var includes data to be changed when the system is normally run. Each system is specific, that is, not shared with other computers over the network.
/var/catman
The cache of the man page when the request is formatted. The source files for the man page are generally in/usr/man/man*, and some of the 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 are often cleared, just as you would clear a temporary directory.) )
/var/lib
The file to change when the system is running normally.
/var/local
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.
/var/lock
Lock the file. Many programs follow conventions that produce a locked file in/var/lock to support their use of a particular device or file. Other programs notice this locked file and will not attempt to use this device or file.
/var/log
Log files for various programs, especially login (/var/log/wtmp log all to the system logon and logoff) and syslog (/var/log/messages store all core and System program information.) Documents in/var/log often grow in an indefinite manner and should be cleared regularly.
/var/run
An information file about the system that is saved until the next boot. For example,/var/run/utmp contains information about the user who is currently logged on.
/var/spool
Mail, news, print queues, and other queue work directories. 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
A temporary file that is larger than/TMP allowed or that requires a longer period of time. (Although the system administrator may not allow/var/tmp to have very old files.) )
/proc File system
The/proc file system is a fake file system. It does not exist on a disk of disks. Instead, the core is generated in memory. Used to provide information about the system (originally about processes, hence the name). Some of the most important files and directories are described below. The/proc file system is described in more detail in the proc man page.
/proc/1
A directory of information about process 1. Each process has a directory named its process number under/Proc.
/proc/cpuinfo
Processor information, such as type, manufacturer, model, and performance.
/proc/devices
A list of device drivers for the currently running core configuration.
/proc/dma
Displays the DMA channel currently in use.
/proc/filesystems
The file system for the core configuration.
/proc/interrupts
Shows the interrupts used, and how many of the each there have been.
/proc/ioports
The I/O port that is currently in use.
/proc/kcore
System physical memory image. Exactly the same size as physical memory, but does not actually occupy so much memory; it is generated on the fly as programs access it. (Remember: Unless you copy it somewhere, nothing in/proc takes up any disk space.) )
/proc/kmsg
The message for the core output. was also sent to Syslog.
/proc/ksyms
The core symbol table.
/proc/loadavg
System "average load"; 3 meaningless indicators indicate the current workload of the system.
/proc/meminfo
Memory usage information, including physical memory and swap.
/proc/modules
Which core modules are currently loaded.
/proc/net
Network protocol status information.
/proc/self
A symbolic connection to the process directory of the program that is viewing/proc. When 2 processes view/proc, it is a different connection. This mainly facilitates the program to get its own process directory.
/proc/stat
Different states of the system, such as the number of page faults since the ' system was booted.
/proc/uptime
The length of time the system started.
/proc/version
Core version.
Note that all of the above files give a readable text file, which can sometimes be a difficult to read format. There are a number of commands that have been formatted to make it easier to read. For example, the free program reads/proc/meminfo and converts the number of bytes given to kilobytes (and adds some information).