The role of each folder in the CentOS system

The role of each folder in the CentOS system

/bin Binary executable command
/dev Device special file
/etc System management and configuration file
/etc/rc.d Configuration files and scripts started by
/home The base point of the user's home directory, for example, the user's home directory is /home/user, You can use ~user to represent
the /lib standard programming library, also known as the dynamic link shared library, which is similar to the .dll file
/sbin system management command in windows, where the management program used by the system administrator
/tmp public temporary files are stored Storage point
/root System administrator's home directory (hehe, privileged class)
/mnt This directory is provided by the system to allow users to temporarily mount other file systems.
/lost+found This directory is usually empty. The system shuts down abnormally and leaves a "homeless" file (what is called .chk under Windows) here
. /proc The virtual directory is the mapping of system memory. This directory can be accessed directly to obtain system information.
/var The overflow area of ​​some large files, such as log files of various services
/usr The largest directory, almost all the applications and files used are in this directory. It contains:
/usr/x11r6 The directory where x windows are stored
/usr/bin Numerous applications
/usr/sbin Some management programs for superusers
/usr/doc Linux documentation
/usr/include Required for developing and compiling applications under linux Header file
/usr/lib Commonly used dynamic link library and software package configuration file
/usr/man help documentation
/usr/src source code, the source code of the linux kernel is placed in /usr/src/linux
/usr/local/bin locally added commands
/usr/local/lib locally added libraries

Under normal circumstances, the space occupied by the root file system should generally be relatively small, because most of the files in it do not need to be changed frequently, and the strict files and a small infrequently changed file system are not easily damaged. The root directory generally does not contain any files except possibly a standard system boot image called /vmlinuz. All other files are in subdirectories of the root filesystem.

  • /bin: The /bin directory contains commands required for booting or commands that ordinary users may use (possibly after booting). These commands are all executable programs of binary files (bin is short for binary -- binary), and most of them are important system files in the system.
  • /sbin: The /sbin directory is similar to /bin and is also used to store binary files. Because most of the files are basic system programs used by system administrators, although ordinary users can use them when necessary and permitted, they are generally not used by ordinary users.
  • /etc: The /etc directory stores various system configuration files, including the user information file /etc/passwd, the system initialization file /etc/rc, etc. Linux is * these files to be able to run properly.
  • /root: The /root directory is the superuser's directory.
  • /lib: The /lib directory is a shared library required by programs on the root file system, and stores the shared files required for running programs on the root file system. These files contain code that can be shared by many programs, so that each program does not contain a copy of the same subroutine, thus making the executable smaller and saving space.
  • /lib/modules: The /lib/modules directory contains various modules that the system core can load, especially those needed to reboot the system when recovering from a corrupted system (such as network and filesystem drivers).
  • /dev: The /dev directory stores device files, namely device drivers, through which users access external devices. For example, a user can access mouse input by accessing /dev/mouse, just like any other file.
  • /tmp: The /tmp directory stores the information and data generated by the program when it is running. But after booting, it is better to use /var/tmp instead of /tmp for running programs, because the former may have a larger disk space.
  • /boot: The /boot directory holds files used by the bootstrap loader, such as lilo, and core images are often placed here, rather than in the root directory. But if there are many core images, this directory can become very large, and a separate filesystem is better. Another thing to note is to make sure the core image must be within the first 1024 cylinders of the IDE hard drive.
  • /mnt: The /mnt directory is a mount point where the system administrator temporarily mounts the file system. The program does not automatically support mounting to /mnt. /mnt can be divided into many subdirectories, for example /mnt/dosa may be a floppy drive using msdos file system, and /mnt/exta may be a floppy drive using ext2 file system, /mnt/cdrom optical drive and so on.
  • /proc, /usr, /var, /home: Mount points for other filesystems.

Detailed introduction

/etc filesystem: The /etc directory contains various system configuration files, some of which are described below. Others you should know which program they belong to and read the man page for that program. Many network configuration files are also in /etc.

  • /etc/rc or /etc/rc.d or /etc/rc?.d : Scripts or directories of scripts that are run when starting, or changing runlevels.
  • /etc/passwd : User database with fields giving username, real name, user home directory, encrypted password and other information about the user.
  • /etc/fdprm : A table of floppy disk parameters to describe different floppy disk formats. Can be set with setfdprm. See the setfdprm help page for more information.
  • /etc/fstab : Specifies a list of filesystems that need to be automatically mounted at startup. Also includes information about swap areas enabled with swapon -a.
  • /etc/group: Similar to /etc/passwd, but instead of user information, it describes group information. Include various data for groups.
  • /etc/inittab : Configuration file for init.
  • /etc/issue : Contains the user's output at the login prompt. Usually includes a short description of the system or a welcome message. The specific content is determined by the system administrator.
  • /etc/magic : The configuration file for "file". Contains descriptions of different file formats, based on which "file" guesses the file type.
  • /etc/motd : motd is the abbreviation of message of the day, which is automatically output after the user successfully logs in. The content is determined by the system administrator. Often used for notification information, such as warnings about planned shutdown times.
  • /etc/mtab : List of currently mounted filesystems. Initialized by a script (scritp) and updated automatically by the mount command. Used when a list of currently mounted filesystems is required (eg the df command).
  • /etc/shadow : The shadow password file on systems with shadow password software installed. The shadow password file moves the encrypted password from the /etc/passwd file to /etc/shadow, which is only readable by the superuser (root). This makes it more difficult to decipher the password, thereby increasing the security of the system.
  • /etc/login.defs : Configuration file for the login command.
  • /etc/printcap: Like /etc/termcap, but for printers. The syntax is different.
  • /etc/profile , /etc/csh.login , /etc/csh.cshrc : Files executed by bourne or c shells at login or startup. This allows system administrators to establish a global default environment for all users.
  • /etc/securetty : Confirms the secure terminal, i.e. which terminal allows superuser (root) logins. Usually only virtual consoles are listed, so that it is impossible (at least very difficult) to break into the system via a modem or network and gain superuser privileges.
  • /etc/shells : Lists available shells. The chsh command allows the user to change the login shell within the scope specified in this file. The service process ftpd that provides a machine ftp service checks if the user's shell is listed in the /etc/shells file, if not, the user will not be allowed to log in.
  • /etc/termcap : Terminal performance database. Describes what "escape sequence" controls are used by different terminals. Instead of outputting escape sequences directly when writing a program (which would only work with a particular brand of terminal), it looks in /etc/termcap for the correct sequence for the job to be done. In this way, most programs can be run on most terminals.

/dev file system: The /dev directory contains device files for all devices. Device files are named with a specific convention, which is described in the device list. Device files are generated by the system during installation and can be described later by /dev/makedev. /dev/makedev.local is a description file written by the system administrator for the local device file (or connection) (ie some non-standard device drivers are not part of the standard makedev). The following briefly introduces some commonly used files under /dev.

  • /dev/console : The system console, which is the monitor directly connected to the system.
  • /dev/hd : IDE hard drive interface. For example: /dev/hda refers to the first hard disk, and had1 refers to the first partition of /dev/hda. If there are other hard disks in the system, the order is /dev/hdb, /dev/hdc, …; if there are multiple partitions, the order is hda1, hda2 … …
  • /dev/sd : scsi disk driver interface. If the system has a scsi hard disk, it will not access /dev/had, but will access /dev/sda.
  • /dev/fd : Floppy device driver. For example: /dev/fd0 refers to the first floppy disk of the system, which is commonly referred to as a: disk, /dev/fd1 refers to the second floppy disk, ... and /dev/fd1h1440 refers to accessing 4 . 5 high-density disks.
  • /dev/st : scsi tape drive driver.
  • /dev/tty : Provides virtual console support. For example: /dev/tty1 refers to the first virtual console of the system, and /dev/tty2 is the second virtual console of the system.
  • /dev/pty : Provides remote login pseudo terminal support. The /dev/pty device is used for telnet login.
  • /dev/ttys : The serial interface of the computer, which is the "com1" port for DOS.
  • /dev/cua : Computer serial interface, a device used with modems.
  • /dev/null : "black hole", all information written to this device will disappear. For example: when you want to hide the output information on the screen, just input the output information into /dev/null.

/usr file system: /usr is a very important directory, usually this file system is large because all programs are installed here. All files in /usr are generally from the linux distribution; locally installed programs and other things are in /usr/local, because this allows you to upgrade to a new system or new distribution without having to reinstall all programs. Much of the content in the /usr directory is optional, but these features make the system more efficient for the user. /usr can hold many large packages and their configuration files. Some important directories are listed below (some less important ones are omitted).

  • /usr/x11r6: Contains all executable programs, configuration files and support files for the xwindow system. To simplify x development and installation, x's files are not integrated into the system. The xwindow system is a powerful graphics environment that provides a large number of graphics tool programs. If users are familiar with microsoft windows or machintosh, they will not feel helpless to the xwindow system.
  • /usr/x386: Similar to /usr/x11r6, but for x11 release 5.
  • /usr/bin: concentrates almost all user commands and is the software library of the system. Other commands are in /bin or /usr/local/bin.
  • /usr/sbin : Contains unnecessary system management commands for the root filesystem, such as most service programs.
  • /usr/man, /usr/info, /usr/doc: These directories contain all man pages, gnu info documentation, and various other documentation files. Each online manual's "section"
    has two subdirectories. For example: /usr/man/man1 contains the source code for the first section of the online manual (unformatted raw files), and /usr/man/cat1 contains the formatted content of the first section. l 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.
  • /usr/include: Contains the header files of the c language, these files mostly end with .h, which are used to describe the data structures, sub-procedures and constants used in the c language program. For consistency, this should actually be placed under /usr/lib, but that name has been carried over by convention.
  • /usr/lib: Contains constant data files for programs or subsystems, including some site-wide configuration files. The name lib comes from the library; the original library for programming is also stored in /usr/lib. When a program is compiled, the program is linked with the libraries in it. There are also many programs that store configuration files in them.
  • /usr/local: Locally installed software and other files are placed here. This is very similar to /usr. Users may find some larger software packages here, such as tex, emacs, etc.

/var file system: /var contains data that is to be changed during normal operation of the system. Usually the size of the directory where the data resides is frequently changed or expanded. Originally, some contents in the /var directory were in /usr, but in order to maintain the relative stability of the /usr directory, we put those directories that need to be changed frequently into /var. Each system is specific, i.e. not shared with other computers over the network.

  • /var/catman: Contains formatted help (man) pages. The source files for help pages are generally stored in /usr/man/man; some man pages may have preformatted versions stored in /usr/man/cat. Other man pages need to be formatted when they are viewed for the first time, and the formatted version is stored in /var/man, so that others do not need to wait for formatting when viewing the same page again. (/var/catman is often purged, just like the temp directory.)
  • /var/lib : Stores files to be changed during normal operation of the system.
  • /var/local: Stores variable data for programs installed in /usr/local (ie, programs installed by system administrators). Note that even locally installed programs use other /var directories, such as /var/lock, if necessary.
  • /var/lock : lock file. Many programs follow the convention of creating a lock file in /var/lock to support the particular device or file they are using. When other programs notice the lock file, they will no longer use the device or file.
  • var/log : log (log) files for various programs, especially login (/var/log/wtmp log records all logins and logouts to the system) and syslog (/var/log/messages records store all core and system programs information). The files in /var/log often grow indefinitely and should be purged periodically.
  • /var/run : Holds information files about the system that are valid until the next system boot. For example, /var/run/utmp contains information about the currently logged in user.
  • /var/spool : Directory for "spooling" programs such as mail, news, print queues, and other queue work directories. Each different spool has its own subdirectory under /var/spool, eg a user's mailbox is stored in /var/spool/mail.
  • /var/tmp : Temporary files that are larger or need to exist longer than /tmp allows. Note that the system administrator may not allow very old files in /var/tmp.

/proc filesystem: The /proc filesystem is a pseudo filesystem, which means that it is a directory that does not actually exist, so it is a very special directory. It doesn't exist on some disk, but is spawned in memory by the core. This directory is used to provide information about the system. Some of the most important files and directories are described below (the /proc filesystem is described in more detail in the proc man page).

  • /proc/x : Directory of information about process x, where x is the identification number of this process. Each process has a directory under /proc named its
    own process ID.
  • /proc/cpuinfo: Stores processor (cpu) information, such as the type, manufacturer, model, and performance of the cpu.
  • /proc/devices : List of device drivers configured by the currently running kernel.
  • /proc/dma : Displays the currently used dma channel.
  • /proc/filesystems: Filesystem information for core configuration.
  • /proc/interrupts : Displays occupied interrupt information and occupant information, as well as the number of occupied interrupts.
  • /proc/ioports : The currently used i/o ports.
  • /proc/kcore : System physical memory image. Exactly the same size as physical memory, however it doesn't actually take up that much memory; it's only created when a program accesses it. (Note: nothing under /proc takes up any disk space unless you copy it somewhere.)
  • /proc/kmsg : Messages output by the core. will also be sent to syslog.
  • /proc/ksyms : The core symbol table.
  • /proc/loadavg : System "load average"; 3 meaningless indicators that indicate the current workload of the system.
  • /proc/meminfo : Various memory usage information, including physical memory and swap partitions (swap).
  • /proc/modules : Stores information about which core modules are currently loaded.
  • /proc/net : Network protocol status information.
  • /proc/self : A symbolic link to the process directory of the program viewing /proc. When 2 processes look at /proc, this will be a different connection. This is mainly for the convenience of a program to get its own process directory.
  • /proc/stat : Different states of the system, for example, the number of page faults since the system started.
  • /proc/uptime : The length of time the system was up.
  • /proc/version : Core version.

Excerpted from online data, typesetting.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324519716&siteId=291194637