Linux directory structure detailed

  

directory summary:

/: root directory, generally only the directory under the root directory, do not store files, /etc, /bin, /dev, /lib, /sbin should and The root directory is placed in a partition. /bin && /usr/bin: The directory where the binary files can be executed, such as the commonly used commands ls, tar, mv, cat, etc. /sbin && /usr/sbin && /usr/local/sbin: Place executable commands used by system administrators, such as fdisk, shutdown, mount, and so on. Unlike /bin, these directories are commands that are used by the system administrator root. Generally, users can only "view" and cannot set and use them. /boot: Place some files used during Linux system startup, such as /boot/vmlinuz (linux kernel file), /boot/grub (boot at boot time). It is recommended to separate partitions, the partition size is 100M. /dev: Stores the device files under the Linux system and accesses a file in the directory, which is equivalent to accessing a device. The commonly used drive is mount /dev/cdrom /mnt. /etc: The directory where the system configuration files are stored. It is not recommended to store executable files in this directory. Important configuration files such as /etc/inittab, /etc/fstab, /etc/init.d, /etc/X11, /etc/sysconfig, /etc/xinetd.d, etc., remember to back up before modifying the configuration file. Note: /etc/X11 stores the settings related to the X server. /home: The default user directory of the system. When a user is added, the root directory of the user is stored in this directory. ~ indicates the root directory of the current user, and ~test indicates the root directory of the user test. It is recommended to separate partitions and set a large disk space for users to store data. /lib && /usr/lib && /usr/local/lib: The library library used by the system. During the execution of the program, the library needs the help of the library when calling additional parameters. The more important directory is /lib/modules. /lost+fount: When a system exception generates an error, some missing fragments are placed in this directory. Usually this directory is automatically generated, such as loading the hard disk in /disk, this directory will automatically generate the directory /disk/lost+found. /mnt: && /media: The default mount point for the CD. Usually the CD is mounted under /mnt/cdrom, and you can choose to mount it at any location. /opt: Adds a directory to the host where the software is installed. For example, the Fedora community development software used by FC4, if you want to install the new KDE desktop software yourself, you can install the software in this directory. In previous Linux systems, it was customary to place it in the /usr/local directory. /proc: The data in this directory is in memory, such as the system core, external devices, and network state. Since the data is stored in memory, it does not take up disk space. The more important directories are /proc/cpuinfo, /proc/interrupts, /proc/dma, /proc/ioports, /proc/net/*, and so on. /root: The root directory of the system administrator root. The first partition of the system is /, so it is best to place /root and /under a partition. /tmp: The directory where the general user or the program being executed temporarily stores the file, which can be accessed by anyone. Important data cannot be placed in this directory. /srv: The data directory that needs to be accessed after the service is started. For example, the webpage data that the www service needs to access is stored in /srv/www. /usr: The application stores the directory, /usr/bin stores the application; /usr/share stores the shared data; /usr/lib can't be run directly, but it is some function library files necessary for many programs to run; /usr/Local storage software upgrade package; /usr/share/doc system description file storage directory; /usr/share/man program description file storage directory, when using man ls will query /usr/share/man/man1/ls.1.gz Content, it is recommended to separate partitions and set a larger disk space. /var: Place files that change frequently during system execution, /var/log to store log files; /var/log/message to store all login files; /var/spool/mail to store mail files; /var/run to store programs or The corresponding PID after the service is started, it is recommended to separate the partition.

Detailed explanation:

/dev directory

****dev is the abbreviation of device. The /dev directory is important to all users because it contains all the external devices used in the Linux system. But here is not the driver for the external device, this is not the same as windows, dos operating system
. It is actually a port that accesses these external devices. We can access these external devices very easily, and access a file, a directory without any difference.

Linux follows the Unix style and recognizes all devices as one file. There are two types of device files: block device file (b) and character device file (c). The device files are usually stored in the /dev directory. The common device files are as follows: /dev/hd[at]: IDE device /dev/sd[az]: SCSI device /dev/fd[0-7]: standard floppy disk drive /dev/md[0-31]: soft raid device /dev/loop[0-7]: local loopback device /dev/ram[0-15]: memory /dev/null: unlimited data receiving device, equivalent to black hole /dev/zero: infinite zero resource /dev/tty[0-63]: virtual terminal /dev/ttyS[0-3]: serial port /dev/lp[0-3]: parallel port /dev/console: 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 device

/dev directory is how to create a node? Devf or udev will automatically create it for you. Kobject is the basis of the sysfs file system. udev monitors and detects sysfs to obtain newly created devices.

/etc Directory /etc/rc && /etc/rc.d && /etc/rc*.d: Start, or change the directory of scripts or scripts that are run at run level /Etc/passwd: User database, where the domain gives the username, real name, root directory, encrypted password, and other information about the user /etc/fstab: mount-a command at startup (in /etc/rc or equivalent) In the boot file) automatically mount the file system list, under Linux, also includes the swap area information enabled with swapon -a /etc/group: similar to /etc/passwd, but not the user but the group /etc/inittab :init configuration file /etc/issue: The output information of getty before the login prompt, usually including a short description or welcome message of the system. The content is determined by the system administrator /etc/motd: Message Of The Day, which is automatically output after successful login, and the content is determined by the system administrator. Frequently used to advertise information, such as the warning of scheduled shutdown time /etc/mtab: The list of currently installed file systems, initialized by scripts, and automatically updated by the mount command. Use when you need a list of currently installed filesystems, such as the df command /etc/shadow: the shadow password file on the system where the shadow password software is installed. The shadow password file moves the encrypted password in the /etc/passwd file to /etc/shadow, while the latter is only readable by the /etc/login.defs:login command in /etc/printcap: similar to /etc/termcap , but for printer syntax, /etc/profile && /etc/csh.login && /etc/csh.cshrc: files that are executed by Bourne or C shells when logging in or starting up, which allows the system administrator to do all The user establishes a global default environment /etc/securetty: confirms the secure terminal, ie which terminal allows root login. Generally only virtual consoles are listed, so it is impossible (at least very difficult) to break into the system via modem or network and get superuser privileges /etc/shells: list trusted shells, chsh command allows users to specify scope in this file Change the login shell /etc/sysconfig: network configuration related directory

/usr directory

/usr The file system is often very large, because all programs are installed here. All files in /usr are usually from the Linux distribution; locally installed programs and other things are under /usr/local. This may not require reinstalling the entire program when upgrading a new system or a new distribution. /usr/etc Store settings file /usr/games Store game and tutorial files /usr/include Store C development tool header files /usr/share Store 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 management commands, such as most service programs /usr/share/man && /usr/share/info && /usr/share /doc man page, GNU information document and various other documentation files /usr/include C programming language header file, in order to be consistent this should actually be under /usr/lib, but the name /usr/lib program is traditionally supported Or the unchanging data files of the subsystem, including some site-wide configuration files. The name lib is derived from the library; the programmed raw inventory is located in /usr/lib /usr/local locally installed software and other files are placed Here /usr/src stores the source code of the program

File type:

Regular file: is a general type of file, in terms of attributes displayed by ls –al The first attribute is [ - ]. In addition, according to the contents of the file, it can be roughly divided into two types of files: Ascii: This is the most common type of Unix system, as long as we can use it as a set file. Binary: usually the executable file except the scripts (text type batch file), this is the file format; directory: directory: directory! The first attribute is [d]; link: it is a shortcut like Windows
! The first attribute is [ l ]; device: Some files related to the system's periphery are usually concentrated under the /dev directory! Usually divided into two types: Block device file: is the interface device that stores data to provide system access, simply a hard disk! For example, the code of your first hard disk is /dev/hda1 and so on! The first attribute is [ b ]; character device file: that is, some serial port interface devices, such as keyboard, mouse, etc.! The first attribute is [ c ].

Copyright © Windows knowledge All Rights Reserved