Linux Command - File Search

File search command

Command name: which
path where the command: / usr / bin / which
execute permissions: All users
Function Description: Display System command directory
Syntax: which [command name]
Which LS
command name: find
the path which the command: / usr / bin / find
execute permissions: All users
description: Find files
syntax: find [the search path] [Search keyword]
find (as far as possible the exact scope, to conserve system resources to open next) based on the file name of the
find / etc -name init looks in the etc of the init
the Find / etc -name init * etc look at the beginning of the document to init
Find / -name init etc etc ?? look at the six beginning letters init
the lookup file size
(in units of blocks, block data of block = 512 bytes = 0.5KB)
is greater than +
Find / etc -size of +200 to find the data block is greater than 200
less than -
equal to
the user to find
find / etc -user root lookup belonging under etc root file
lookup according to the time
c- change change file attributes has been modified, the owner, owning group, permissions
a-access access
m-modify modify the contents of the file are to turn over
In days -ctime, -atime, -mtime
in minutes -cmin, -amin, -mmin
- within + exceeds
find / etc -mmin -120 two hours the contents are modified file.

Connector
-a logic
-o logic or
lookup file type
-type
Find / etc -type F / L / D (binary, link file, directory)
of the file is processed to find
find ... -exec command {};
{} result of the search
\ escape character
find / etc -name init -exec rm { }; find init file delete
-ok = -exec ok will be asked to confirm the
name of the command: grep
path where the command: / bin / grep
execute permissions: All users
description: match the search string in the document output line
syntax: grep ftp / etc / services in the services contained in the ftp line output

Guess you like

Origin blog.csdn.net/weixin_41998682/article/details/89677391