Common Linux Log query commands

Source: Internet
Author: User

1. View the Live log:

Tail- F nohup.out

2. Paging to view all logs:

Cat Nohup. Out |

4. Paging through the top N rows of logs:

Tail-n nohup. Out | More

5. View real-time logs and retrieve keywords:

Tail- F nohup.out | grep "keyword"

6. Retrieve the log and display the pre-and post-n-Row Records of the log:

Cat Nohup. Out | grep- n -b10 -a10 "keyword"

7. View the log, starting with line 1000th and displaying 500 rows:

Cat Nohup. Out | tail - n+| Head - n -

# # # 8. View the log, display 1000 rows to 1500 lines: "Shell cat nohup.out | head-n 1500| tail-n +

9. Delete the line that includes the keyword:

Sed-i '/keyword/d ' nohup. out

Common Linux Log query commands

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.