File Search command Find
Command name: Find
Command path:/bin/find
Execute Permissions: All Users
Syntax: Find [Search Range] [match condition]
Function Description: File search
-name Search by file name: find/etc/-name init fuzzy search uses wildcard characters * Find/etc-name *init* matches a single character using a wildcard? Find/etc-name init??
-iname Search by file name (case insensitive)
-size in the directory according to the file size look for example: Find/-size +204800 (+; n is less than; n equals the search size in chunks, 1 blocks = 512 bytes =0.5k;100mb=1024000kb= 204800 data blocks)
-user in the directory under the owner-condition Lookup Example: Find/home-user xiaoming
-group based on the owning group
-amin Access by file for a period of time (access) Find an example: find/etc-amin-5 (+: how long;-: how long)
-cmin Modify file attribute (change) Lookup example based on file for a period of time: find/etc-cmin-5
-mmin Modify the file contents (modify) for a period of time based on the file look for an example: find/etc-mmin-5
-type Search by file type (f: File D: directory; L: Soft link file)
-inum based on I-node lookup
Connection query for search criteria
-a two conditions at the same time satisfied example: Find/etc-size +163840-a-size-204800
-O two conditions to satisfy any one example: Find/etc-size +163840-o-size-204800
-exec/-ok command {} \; To perform an operation on a search result: Find/etc-name init-exec ls-l {} \; Find/etc-name init-ok ls-l {} \; (The action that will be queried for each qualifying result, such as deleting a search file Find/etc-name init*-ok rm {} \; asks if each file is deleted )
Other Search commands
Command name: Locate (-I case insensitive)
Command path:/usr/bin/locate
Execute Permissions: All Users
Syntax: Locate file name
Function Description: Find files in the file repository (file repository/var/lib/mlocate/mlocate.db,linux will periodically synchronize the file information to this file, the execution of the updatedb command will immediately update the file repository,/ TMP directory is not in the file repository) Example: Locate Inittab;
Command name: which
Command path:/usr/bin/which
Execute Permissions: All Users
Syntax: which command
Function Description: Search command directory and alias Information example: which LS
Command name: Whereis
Command path:/usr/bin/whereis
Execute Permissions: All Users
Syntax: Whereis [command name]
Function Description: Search command directory and Help document path example: Whereis ls
Command name: grep
Command path:/bin/grep
Execute Permissions: All Users
Syntax: Grep-iv [Specify string] [file]
Function Description: Search for string matching lines in the file and output-I case-insensitive-V-Exclude specified string example: grep mysql/root/install.log
Linux Common commands-File Search command find