Linux Common Check log skills

Source: Internet
Author: User
Tags ssh account

First, the basic

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"

Linux Common Check log skills

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.