Section V command to find the directory file

find Find files or directories
syntax: find [the search path] [matching condition], if no path is searched in the current path
principle: take up system resources on the most, that is, the smallest your search query most accurate
Note: If you explicitly want to find in which a file directory, the directory to find the specified directly, without searching the root of
1) -name Search by name, pinpoint
find / root / a -name 'a.txt ' look at a.txt / root / a
2) -iname not case sensitive
the Find / root / a -iname 'A.txt'
3) match the characters
find find / root / a -name ' a?' Find a + character any directory or file
find find / root / a -name 'a *' find the beginning of a file or directory anywhere
4) -size Search by file size
in units of block, is a block 512B, 1K = 2block + is greater than - equal to the write is not less than the
find / root / a -size +204800 lookup file smaller than 100MB
5) -type find by file type
f binary
l flexible connection file
d directory
c character file
find / root / a -type c

grep in a file (not a directory) search string matching and output line
syntax: grep [-cinv] 'search string' filename
number -c output matching line (at the row level, not in the number of occurrences of units)
-i ignore case
-n display matching lines and the line number
-v reverse selection display line does not contain all of the matched text
grep -i -n 'over' aa.txt
grep -i -n 'a' aa.txt
# grep -v '^ #' a.txt code does not look to the line beginning with #, that is, print out the file does not contain comments from the

which displays the directory (absolute path and alias) system commands
the role which the command is in the PATH variable specified path, searching for the location of a system command, and returns the first search result, that is, the use of which, it is you can see whether there is a system command, and command execution in the end which is a position
which ls the following instructions appear, are details of the ls command, the command ls explanation is there
ls = 'ls --color = auto

Which zs presence information of the following instruction described instruction zs is absent
/ usr / bin / which: no zl in (/ usr / local / sbin: / usr / local / bin: / sbin: / bin: / usr / sbin : / usr / bin: / root / bin)

whereis command searches the directory where the configuration files and directories help documentation
whereis LS
LS: / bin / LS /usr/share/man/man1/ls.1.gz

whereis man
man: /usr/share/man

Guess you like

Origin www.cnblogs.com/kogmaw/p/12409942.html