Whereis locate in the database to find, updatedb Update database, need root
Find in hard drive (slower)
Locate
| -I. |
Ignore Case differences |
| -R |
Can be followed by the display of regular notation |
Which (looking for executable files)
| -A |
List all instructions that can be found in the PATH directory and not just the first one found |
Whereis (looking for a specific file)
| -B |
Find files in binary format |
| -M |
Locate the file under the manual path of the documentation |
| -S |
Find source file |
| -U |
Search and other special files in the above three projects |
Find-atime-ctime-mtime
| -mtime N |
Files that have been changed within a day before n days |
| -mtime +n |
Lists the file names of the content that were changed before n days (excluding the N-day itself); |
| -mtime-n |
Lists the file names of the content that have been changed within n days (including the N-day itself). |
| -newer FILENAME |
List new file names than filename |
+4 represents a file name that is greater than or equal to 5 days ago: Find/var-mtime + 4-4 for files less than or equal to 4 days: find/var-mtime-4 4 is the file name for the previous 4-5 day: Find/var-mtime 4
User or group name
| -uid N |
The user's account ID, UID, this UID is recorded in the/etc/passwd and the account name corresponds to the number. |
| -gid N |
ID of group name, GID, GID record in/etc/group |
| -user NAME |
Name of user account |
| -group NAME |
For group name |
| -nouser |
Find out if there is no master |
| -nogroup |
Not present in/etc/group |
-name:
| -name Fimename |
Search files named filename |
-size:
| -size [+-]size |
Search for files larger than size (+) or small (-). |
SIZE:
| C |
Represents a byte |
| K |
Represents 1024bytes |
For example: A file larger than 50KB is-size +50k
-type
| F |
Normal file |
| B |
Block device |
| C |
Character device |
| L |
Link file |
| D |
Directory |
| L |
Link file |
| S |
Socket |
| P |
Pipeline files |
-perm
-perm-xxx
-depth
First match all the files and then go to the subdirectory to find them.
-mount
Find from the current file system (without entering another file system).
-exec/ok
After you get to find, manipulate the content found by find. For example, RM, ls
Format Find ~/work/-type d-name "Assembly"-exec ls {} \;-exec + command {} \;
If it is-ok, the command will be executed when the command is executed.
Linux Notes--find