Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

File structure under LINUX

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly introduces "the file structure under LINUX". In the daily operation, I believe that many people have doubts about the file structure under LINUX. The editor consulted all kinds of data and sorted out simple and easy-to-use operation methods. I hope it will be helpful to answer the doubts about "file structure under LINUX". Next, please follow the editor to study!

/ bin binary executable command

/ dev device special file

/ etc system Administration and configuration File

Configuration files and scripts started by / etc/rc.d

/ home the base point of the user's home directory, for example, the home directory of the user user is / home/user, which can be represented by ~ user

/ lib standard programming library, also known as dynamic link sharing library, acts like .dll files in windows

/ sbin system management commands, where the management programs used by the system administrator are stored

/ tmp common temporary file storage point

/ root system administrator's home directory (hehe, privileged class)

The / mnt system provides this directory to allow users to mount other file systems temporarily.

The directory / lost+found is usually empty, and the "homeless" file (.chk under windows) is here when the system is shut down abnormally.

/ proc virtual directory, which is the mapping of system memory. You can access this directory directly to get system information.

/ var the overflow area of some large files, such as log files for various services

The largest directory of / usr, where almost all the applications and files to be used are located. It contains:

/ usr/x11r6 directory where x window is stored

/ usr/bin numerous applications

Some hypervisors of / usr/sbin super user

/ usr/doc linux document

Header files required for developing and compiling applications under / usr/include linux

Configuration files of dynamic link libraries and software packages commonly used in / usr/lib

/ usr/man help documentation

/ usr/src source code, the source code of the linux kernel is in / usr/src/linux

/ usr/local/bin locally added commands

/ usr/local/lib locally added libraries

In general, the root file system should take up a small amount of space, because most of the files do not need to be changed frequently, and including strict files and a small file system that does not change often, are not easily corrupted. Except for a possible system boot image called the / v m l i n u z standard, the root directory generally does not contain any files. All other files are in a subdirectory of the root file system.

1. / bin directory

The / b i n directory contains commands required for boot startup or commands that a normal user might use (perhaps after boot startup). These commands are executable programs for binary files (b i n is b i n a r y-short for binary), and most of them are important system files in the system.

2. / sbin directory

The / s bin directory, similar to / bin, is also used to store binaries. Because most of the files are basic system programs used by system administrators, although ordinary users can use them when necessary and allowed, they are generally not available to ordinary users.

3. / etc directory

The / e t c directory stores various system configuration files, including user information file / e t c / p a s s w d, system initialization file / e t c / r c and so on. L i n u x is precisely * that these files work properly.

4. / root directory

The / root directory is the superuser's directory.

5. / lib directory

The / l i b directory is a shared library required by programs on the root file system, which stores the shared files needed for the root file system programs to run. These files contain code that can be shared by many programs to prevent each program from containing a copy of the same subroutine, so it can make the executable file smaller and save space.

6. / lib/modules directory

The / lib/modules directory contains the system core that can load a variety of modules, especially those needed to reboot the system when recovering a damaged system (such as network and file system drivers).

7. / dev directory

The / d e v directory stores device files, that is, device drivers, through which users access external devices. For example, users can access mouse input by visiting / d e v / m o u s e, just like other files.

8. / tmp directory

The / tmp directory stores the information and data generated by the program at run time. However, after the boot starts, it is best to use / v a r / tmp instead of / tmp, because the former may have a larger disk space.

9. / boot directory

The / boot directory holds files used by the boot loader (bootstrap loader), such as l i lo, and the core image is often placed here, rather than in the root directory. But if you have many core images, this directory may become very large, and it would be better to use a separate file system. It is also important to note that the core image must be within the first 10 2 4 cylinders of the i d e hard drive.

10. / mnt directory

The / m n t directory is the mount point where the system administrator temporarily installs (m o u n t) the file system. The program does not automatically support installation to / mnt. / mnt can be divided into many subdirectories, for example, / mnt/dosa may be a floppy drive using the m s dos file system, and / mnt/exta may be a floppy drive using the ext 2 file system, / mnt/cdrom CD-rom drive, and so on.

11. / proc, / usr,/var,/home directory

Mounting points for other file systems.

The following is described in detail

/ etc file system

The / etc directory contains various system configuration files, some of which are described below. The rest of you should know which program they belong to 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

Start, or change the directory of the script or script that runs at the runtime.

2. / etc/passwd

A user database in which the domain gives the user name, real name, user starting directory, encrypted password, and other information about the user.

3. / etc/fdprm

Floppy disk parameter table, which is used to describe different floppy disk formats. Can be set with setfdprm. For more information, see the s e t f d p r m help page.

4. / etc/fstab

Specifies a list of file systems that need to be automatically mounted at startup. Information about the swap zone enabled with swapon-an is also included.

5. / etc/group

Similar to / etc/passwd, but not user information but group information. Including all kinds of data for the group.

6. / etc/inittab

Configuration file for init.

7. / etc/issue

Includes the user's output before the login prompt. It usually includes a short description or welcome message of the system. The specific content is determined by the system administrator.

8. / etc/magic

Configuration file for "f i l e". Contains descriptions of different file formats, based on which "f i l e" guesses the file type.

9. / etc/motd

M o t d is an acronym for message of the day, which is automatically output when a user logs in successfully. The content is determined by the system administrator. It is often used to announce information, such as a warning of a planned shutdown time.

10. / etc/mtab

List of currently installed file systems. Initialized by the script (s c r i t p) and automatically updated by the mount command. Use when you need a list of currently installed file systems (for example, the df command).

11. / etc/shadow

The shadow password file on the system where the s h a d o w password software is installed. The shadow password file moves the encrypted password from the / e t c / p a s s w d file to / e t c / s h a d o w, which is readable only to the superuser (r o o t). 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 l o g i n command.

13. / etc/printcap

Similar to / etc/termcap, but for printers. The grammar is different.

14. / etc/profile 、 / etc/ c s h. L o g i n 、 / etc/csh.cshrc

A file executed by b o u r n e or c shells at login or startup. This allows the system administrator to establish a global default environment for all users.

15. / etc/securetty

Confirm the secure terminal, that is, which terminal allows superuser (r o o t) login. Generally only virtual consoles are listed, so it is not possible (at least difficult) to break into the system through a modem (m o d e m) or network and get super user privileges.

16. / etc/shells

Lists the s h e l l you can use. The chsh command allows the user to change the login sh e l l within the scope specified in this file. The service process ftpd that provides a machine ftp service checks whether the user shell is listed in the / etc/shells file, and if not, the user will not be allowed to log in.

17. / etc/termcap

Terminal performance database. Explain what "escape sequence" control is used by different terminals. Instead of directly outputting escape sequences (which only work on terminals of a particular brand) when writing programs, you look 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 includes device files for all devices. The device file is 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 with / dev/makedev. / dev / makede v.local is a description written by the system administrator for local device files (or connections) (for example, some non-standard device drivers are not part of the standard makedev). Here is a brief introduction to some common files under / 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 disk driver interface. For example, / d e v / h d a refers to the first hard disk, and h a d 1 refers to the first partition of / d e v / h d a. If there are other hard drives in the system, they are / d e v / h d b, / d e v / h d c,. . . . . .; if there are multiple partitions, they are h d a 1 and h d a 2. . . . . .

3. / dev/sd

S c s i disk driver interface. If a system has a s c s i hard drive, it will not access / d e v / h a d, but will access / d e v / s d a.

4. / dev/fd

Floppy drive device driver. For example, / d e v / f d 0 refers to the first floppy disk of the system, which is commonly known as a: disk, and / d e v / f d 1 refers to the second floppy disk. . . . . . And / d e v / f d 1 h 1 440 indicates access to 4. 0 in drive 1. (5) High density disk.

5. / dev/st

S c s i tape drive driver.

6. / dev/tty

Provides virtual console support. For example, / d e v / t t y 1 refers to the first virtual console of the system, and / d e v / t t y 2 is the second virtual console of the system.

7. / dev/pty

Provide remote login pseudo terminal support. The / d e v / p t y device is used for te l n e t login.

8. / dev/ttys

Computer serial interface, for d o s, is the "c o m 1" port.

9. / dev/cua

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 on the screen, just input the output information into / d e v / n u l l.

/ usr file system

/ usr is a very important directory, and the file system is usually large because all programs are installed here. All files in / usr are generally from the l i n u x distribution (d i s t r i b u t i o n); locally installed programs and other things are under / usr/local, because you don't have to reinstall all programs when upgrading a new version of the system or distribution. Many of the contents in the / usr directory are optional, but these features will make users use the system more efficiently. / u s r can accommodate many large software packages and their configuration files. Some important directories are listed below (some less important ones are omitted).

1. / usr/x11r6

Contains all executable programs, configuration files, and support files for x window systems. To simplify the development and installation of x, the files of x are not integrated into the system. X window system is a powerful graphics environment, which provides a large number of graphics tools and programs. If users are familiar with microsoft window s or m a c h in t os h, they will not be at a loss about the x window system.

2. / usr/x386

Similar to / u s r / x 11r6, but specific to x 11 release 5.

3. / usr/bin

It centralizes almost all the user commands and is the software library of the system. 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 、 / usr/ i n f o 、 / usr/ d o c

These directories contain all man pages, g n u information documents, and various other documentation files. Each section of the online manual has two subdirectories. For example, / u s r / m a n / m a n 1 contains the source code for the first section of the online manual (there is no formatted original file), and / u s r / m a n / c a t 1 contains the formatted content 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 header files of the c language, most of which are. H ending, which is used to describe the data structures, subprocedures and constants used in c language programs. For consistency, this should actually be placed under / usr/lib, but the name has always been used

Words.

7. / usr/lib

Contains immutable data files for programs or subsystems, including some s i t e-w i d e configuration files. The name lib comes from the library (library); the original library for programming also exists in / usr/lib. When the program is compiled, the program connects to the libraries in it. There are also many programs that store configuration files.

8. / usr/local

Locally installed software and other files are placed here. This is very similar to / u s r. Users may find some larger software packages here, such as t e x, e m a c s, and so on.

/ var file system

/ var contains data to be changed when the system is generally running. Usually, the size of the directory in which the data is located is often changed or expanded. It turns out that some of the contents of the / v a r directory are in / u s r, but in order to keep the / u s r directory relatively stable, put those directories that need to be changed frequently into / v a r. Each system is specific, that is, it is not shared with other computers over the network.

Some important directories are listed below (some less important ones are omitted).

1. / var/catman

Includes formatted help (m a n) pages. The source files for help pages generally exist in / u s r / m a n / m a n; some m a n pages may have preformatted versions and exist in / u s r / m a n / c a t. Other man pages need to be formatted when they are viewed for the first time, and the formatted version exists in / var/man so that others don't have to wait for formatting when they look at the same page. / var/catman is often cleared, just like clearing a temporary directory.)

2. / var/lib

Store the files to be changed when the system is running normally.

3. / var/local

Stores variable data for programs installed in / usr/local (that is, programs installed by system administrators). Note that even locally installed programs will use other / var directories, such as / var/lock, if necessary.

4. / var/lock

Lock the file. Many programs follow the convention of generating a locked file in / var/lock to support that they are using a particular device or file. When other programs notice the locked file, they will no longer use the device or text

Pieces.

5. / var/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 stores all core and system program information). Files in / var/log often grow indefinitely and should be cleared on a regular basis.

6. / var/run

Save the valid information file about the system before the next system boot. For example, / var/run/utmp contains information about the user who is currently logged in.

7. / var/spool

Places directories for s p o o l programs, such as m an i l, n e w s, print queues, and other queues to work. Each different spool has its own subdirectory under / var/spool, for example, the user's mailbox is stored in / var/spool/mail.

8. / var/tmp

Temporary files that are larger or need to exist for a longer time than / tmp are allowed. Note that your system administrator may not allow / var/tmp to have very old files.

/ proc file system

The / proc file system is a pseudo file system, which means it's a directory that doesn't actually exist, so it's a very special directory. It does not exist on a disk, but is generated by the core in memory. This directory is used to mention

For information about the system. Some of the most important files and directories are described below (the / proc file system is described in more detail on the proc man page).

1. / proc/x

The directory of information about process x, which is the identification number of the process. Each process has a directory under / proc called its own 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

A list of device drivers that are currently running core configurations.

4. / proc/dma

Displays the d m a channel currently in use.

5. / proc/filesystems

File system information for the core configuration.

6. / proc/interrupts

Displays occupied interrupt information and occupant information, as well as the number of occupied.

7. / proc/ioports

The I o port currently in use

8. / proc/kcore

System physical memory image. It's exactly the same size as physical memory, but it doesn't actually take up that much memory; it's only created when the program accesses it. (note: unless you copy it somewhere, there is nothing under / proc

Things take up any disk space.)

9. / proc/kmsg

The message output by the core. Will also be sent to s y s l o g.

10. / proc/ksyms

Core symbol table.

11. / proc/loadavg

The 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 which core modules are currently loaded.

14. / proc/net

Network protocol status information.

15. / proc/self

Symbolic links stored in the process directory of the program that views / proc. When two processes view / proc, this will be a different connection. This is mainly convenient for the program to get its own process directory.

16. / proc/stat

The different states of the system, for example, the number of page errors that occurred after the system started.

17. / proc/uptime

The length of time for the system to start.

18. / proc/version

Core version.

At this point, the study of "file structure under LINUX" is over. I hope to be able to solve your doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report