Linux Records-Filter logs sed, find, tail,du command

Source: Internet
Author: User

1. View logs for a certain period of time

#cat Hdfs-audit.log | Sed-n '/2018-04-11 10:00:00/,/2018-04-11 10:01:00/p ' | More---Direct use time period

#cat Hdfs-audit.log | Sed-n '/2018-04-11 09:[0-9][0-9]/,/2018-04-11 10:[0-9]:[0-9]/p ' | More---Use regular expressions

#sed查看log时间段 (sed-n '/start/,/end/P ' p is printed out, D is deleted)

2. View the end of the log 100 lines

#tail-F-N-Hdfs-audit.log

3. Delete files with folders larger than 1G

#find/home/test/-size +1024m-exec rm {} \

4. View the TCP connection type

#netstat-an|awk '/tcp/{print $6} ' |sort|uniq-c

5. Number of statistics File bytes

Wc-c Hdfs-audit.log

6. View File and folder size

Du-ah--max-depth=1

Linux Records-Filter logs sed, find, tail,du command

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.