8.8 "Linux learning is not difficult" Linux Common Operations Command (8): Find command finds eligible files
You can use the Find command to list eligible files in the file system, specifying the name, category, time, size, and permissions of the file, and only the files that are fully matched will be listed.
command syntax:
Find [ path ] [ options ]
The meanings of the options in the command are as shown in the table.
Options |
option meaning |
-name < file name > |
find files by file name |
-perm < permissions > |
to find files according to the permissions of the file |
-user < user name > |
find files by user owner of the file |
-group < group name > |
Find files According to the group owner of the file |
-atime N |
Files that have been accessed in the last n days (atime),n represents a number |
-amin N |
Files that have been accessed in the last n minutes (atime),n represents a number |
-ctime N |
Files that have been changed in the last n days (CTime),n represents a number |
-cmin N |
Files that have been changed in the last n minutes (CTime),n represents a number |
-mtime N |
Files that have been modified in the last n days (mtime),n represents a number |
-mmin N |
Files that have been modified in the last n minutes (mtime),n represents a number |
-size N[CKMG] |
find Files of size n ,n for numbers,C for bytes,k for KB,M for MB, G represents GB |
-empty |
find an empty file, which can be an ordinary file or directory |
-type < file types > |
Find files by file type |
-fstype < file system types > |
to find files by specifying the file system type |
-uid < user uid> |
according to the user owner of the file UID to find the file |
-gid < group gid> |
According to the group owner of the file GID to find Files |
-inum N |
Find Files by the inode number of the file |
-writable |
Matching writable Files |
you can define different file types when you look for a file, as shown in the table.
character |
meaning |
B |
Block device Files |
D |
Catalogue |
C |
Character device Files |
P |
Pipeline Files |
L |
Symbolic Link File |
F |
Normal file |
S |
Socket File |
Example: Find the boot menu profile grub.cfg under the /boot directory.
[Email protected] ~]# Find/boot-name grub.cfg
Example: Find "/" all the directories under the ". conf" file for the extension.
[[email protected] ~]# Find/-name ' *.conf '
Example: Lists all files that have been changed in the current directory and its subdirectories under all recent days.
[[email protected] ~]# find. -ctime-20
Example: In the/ boot directory, look for files of the file type directory.
[Email protected] ~]# Find/boot-type D
this excerpt from linux learning linux introductory textbook. To read the entire book, please visit OPS ( www.linuxywz.com
Linux learning is not difficult "Linux Common Operations Command (8): Find command finds eligible files