CentOS file search commands
File SEARCH Command
Which [command name]
Function: displays the directory of the System Command (absolute path)
$ Which ls
Whereis can display Command help information, help file description stored information
Find-common SEARCH Command
Syntax: find [search path] [Search Keyword]
Function: searches for files or directories.
-Name: search by file name
Find/etc-name init
Find the file init In the/etc directory (only matching the file name init, wildcard * matching any character including zero characters)
Init *: file starting with init
? : Match a single character init ??? : There are three symbols after init
-Size: the size of the file. The block size is 512 bytes.
100 MB = 102400kb = 204800 data block (only data block representation is supported)
Find/-size + 204800
Search for files larger than MB in the root directory
(Greater than + less than-equal)
Find/home-user samlee
Find the file whose owner is samlee in the root directory.
Time
1. ctime, atime, and mtime in days
2. cmin, amin, and mmin minutes
C-change indicates that the file property has been modified.
A-access
M-modify: indicates that the file content has been modified.
-Inner
+ Exceeds
Find/etc-mmin-120
Find/etc-ctime-1
Search for the files and directories under/etc that have been modified within 24 hours.
Find/etc-size + 163840-a-size-204800
Search for files larger than 80 mb and smaller than MB in/etc
Find/etc-name inittab-exec ls-l {}\;
Search for the inittab file in/etc and display its details
-Type file type f binary file l soft link file d directory
1. connector-a and logic and-o or logic or
2. connector find ..... -Exec command {}\;
{} Find query results
\ Escape character, meaning of the symbolic command itself
-OK
No matter what the file name is, you can find it based on the I node of the file.
The kernel can call it.
File SEARCH Command: locate
Locate (Search Keyword)
List all file-Related Files
File SEARCH Command: updatedb
Execution permission: root
Syntax: updatedb
Function Description: creates a database for the entire system directory file.
Example: # updatedb
File SEARCH Command: grep
Syntax: grep [specified string] [source file]
Function Description: searches for matched strings in a file and outputs the results.
Example: grep ftp/etc/services
Help commands
:
Command name: man
Manual
Command path:/user/bin/man
Execution permission: User used
Syntax: man [command or configuration file]
Function Description: Get help information
Man ls
Man services
Help Command: info
Syntax: info [any keyword]
Function Description: Get help information {This command is not available in unix}
Help Command: whatis
Whatis
Command name: whatis apropos makewhatis
Search the whatis database for strings
Syntax: whatis apropos [any keyword]
Function Description: Get Brief description of the index.
Apropos fstab is equivalent to man-k
Additional command: help to view the help of shell built-in commands
Common linux commands: compression and decompression commands
-Gz
Command: Gnu zip
Syntax: gzip option [file]
Function Description: compress a file.
Compressed file format:. gz
1. Only files can be compressed and directories cannot be compressed.
2. Do not retain the source file
Decompress command: gunzip
Syntax: gunzip option [compressed file]
Function Description: Decompress the. GZ compressed file.
Example: gunzip file1.gz
Compressed and decompressed Directory: tar
Command name: tar
Syntax tar option [cvf] [Directory]
-C producer .tar package the file
-V: Show Details
-F: Specifies the compressed file name.
-Simultaneous compression of z package
Compressed file format: .tar.gz