Command |
Function |
Grammar |
Description |
Cat |
1. Display the entire file at once. 2. Create a file from the keyboard. 3. Merge several files into one file. |
1. cat file name 2. cat > FileName 3. Cat File1 file2 > file |
After the |grep can be found by keyword, more than one keyword can be used |grep, such as: |grep a |grep b |
Tail |
Displays the following lines of the specified file |
tail [+/-num] [number of lines] File |
+ Starting at the beginning of the file -Counting from the end of the file After the |grep can be found by keyword, more than one keyword can be used |grep, such as: |grep a |grep b |
grep search Text |
A powerful text-search tool that It can search for text using regular expressions, and print out the matching lines. |
grep [-ACINV] [--color=auto] ' search string ' filename |
Options and Parameters:-A: Searches binary files for data as text files-C: Calculates the number of ' search strings ' found by-I: ignores case differences, so the case is treated as the same-N: by the way output line number-V: Invert selection, which shows the line without the ' search string ' content! --color=auto: Can be found in the keyword part of the color display Oh! |
grep Find Directory |
Finding a directory recursively based on file content |
1, grep ' energywise ' * 2, grep-r ' energywise ' * 3, Grep-l-R ' EnergyWise ' * |
1. Search for files with ' EnergyWise ' in the current directory 2 . Search for ' energywise ' files in the current directory and its subdirectories 3. Search for ' energywise ' files in the current directory and its subdirectories, But no matching rows are displayed, only matching files are displayed |
grep regular Match |
|
1, grep-n ' t[ae]st ' regular_express.txt 2, Grep-n ' [^a-z]oo ' Regular_express.txt 3, grep-n ' ^the$ ' regular_express.txt 4, Grep-n ' G. d ' Regular_express.txt |
1, [] inside no matter how many bytes, he would like to represent a "one" byte 2, oo front do not want to have a small letter section, If you have uppercase English/lowercase English/numbers and so on, you can use [a-z],[a-z],[0-9] and other ways to write, If our request string is digital and English, change to: [A-za-z0-9] 3. Beginning and end of line 4, any one byte. With repeating bytes * |
Sz |
Send file to Local |
SZ filename |
After executing the command, select Save path in the pop-up box |
Rz |
Uploading files locally to the server |
Rz |
After executing the command, select the file you want to upload in the pop-up box |
Cd |
to catalog |
CD [Path] |
When path is empty, it goes to the root of the current operator and gets the highest permissions |
Cp |
Copying files |
CP filename |
|
Unzip |
Unzip zip |
Unzip-o [-d/home/sunny] Myfile.zip |
Unzip the Myfile.zip file to/home/sunny/ -O: Overwrite the file without prompting; -d:-d/home/sunny indicates that the file is extracted to the/home/sunny directory, and when it is not written, it is extracted to the current directory |
Ssh |
Login Host |
SSH account @ Host IP |
|
Awk |
Formatting text information |
1, awk '/keyword/{print NR, $;} ' file name 2. awk ' {if (nr >= 13905 && nr <= 13915) print NR, $;} ' Filename |
1. Print line number Keywords if they contain special characters, although they are escaped with \ NR record number per row The variable is the entire record 2, output line 13905 to line 13915 between the content |
Date |
Convert the date and time format |
date-d @ number of seconds + "%y-%m-%d%h:%m:%s" |
|