Reference: "Bird's-brother Linux private Cuisine" The first seven chapters, 17/12/5 review
FHS Standard
Third-party software generally in/USR/SRC or/opt
Kernel source code in/USR/SRC
/ Root
/bin -user binary files
In single-user mode, the common Linux commands you need to use are located in this directory. The commands used by all users of the system are set here.
For example: PS, ls, ping, grep, CP8
/sbin
It is usually used by system administrators to maintain the system. Example: Iptables, reboot, Fdisk, ifconfig, swapon commands
/ etc -configuration file
Hosts: The resolution of the device name (or domain name) to the IP address, equivalent to the local presence of DNS functionality.
/ Dev -device files
These include terminal equipment, USB or any device connected to the system. For example:/dev/tty1,/dev/usbmon0
/proc -Process information
This is a virtual file system that contains information about the processes that are running. For example: The/proc/{pid} directory contains information related to a specific PID.
/ var -variable file
This directory allows you to find files that may grow in content. Includes-System log files (/var/log), Package and database files (/var/lib), e-mail (/var/mail), print queue (/var/spool), lock file (/var/lock), and multiple restarts of required temporary files (/var/tmp);
/ tmp -temp file
Contains system and user-created temporary files. When the system restarts, the files in this directory will be deleted.
/ usr -unix software Resourse
Source code that contains binaries, library files, documents, and level two programs.
The/usr/bin contains a binary file of the user program. If you can't find the user binaries in/bin, go to the/usr/bin directory to see. For example: At, awk, CC, less, SCP.
The/usr/sbin contains the system administrator's binaries. If you can't find the system binaries in/sbin, go to the/usr/sbin directory to see it. For example: ATD, Cron, sshd, Useradd, Userdel.
The/usr/lib contains the libraries used by/usr/bin and/usr/sbin.
The user program installed from the source is included in the/usr/local. For example, when you install Apache from the source, it will be in/usr/local/apache2.
/home Directory
All users use the home directory to store their personal files.
For example:/home/john,/home/nikita
/ boot -boot loader files
The kernel's initrd, vmlinux, and grub files are located under/boot. Example: Initrd.img-2.6.32-24-generic
/lib -System Library
Contains library files that support binary files located under/bin and/sbin.
The library file is named LD or Lib. So.* for example: ld-2.11.1.so,libncurses.so.5.7
/opt -Optional add-on application
Contains additional applications from individual vendors.
/mnt -Mount Directory
A temporary installation directory where the system administrator can mount the file system.
/media -removable media devices
A temporary directory that is used to mount removable devices.
For example, the/media/cdrom,windows attached to the CD-ROM is also usually hung here
/srv -Service data
Contains data related to server-specific services.
For example,/srv/cvs contains CVS-related data.
- which
Find execution files based on path
- Whereis
Finding files in the database
- Locate
updatedb updating database; fuzzy matching;-I ignoring case;-R regular matching
- Find
Find | path| | option| |file|
The day-mtime n,n days ago
-mtime +n,n days ago (n days not included)
Within-mtime-n,n days (including n days)
-newer file, newer than file
-user Name
-group Name
-nouser
-name filename
-size +/-100c;c for Bytes,k to kb,m for Mb,g GB
-type Type;type has the following types: F generic file, b/c device file, D directory, L link file, s socket, p pipeline
-perm mode; The file with the right mode;-mode superset, must all include a subset of Mode;+mode, including any mode
-exec plus other commandsfind /tmp -newer test1 -exec ls -l {} \;
Exercise: Build two accounts TMP1 and TMP2, support the same user group project, need to co-own the development rights of the/srv/ahome directory, and the directory does not allow other users to access