linux 查看log里面的error

时间:2020-03-27 11:50:04   收藏:0   阅读:181

find / -name a.txt : 从根目录下全局搜索a.txt文件

grep “error” test.log :从test.log中过滤出包含error的文本行

grep -A 10 "error" test.log  :过滤制定数据,并展示后10行

grep -B 10 "error" test.log :过滤指定数据,并展示前10行

grep -C 10 "error" test.log :过滤指定数据,并展示前后10行

文件查看

cat ./a.txt :一次性读取并打印a.txt文件里的所有信息

more ./a.txt :读取a.txt 文件,每次读取一屏,按空格键翻页

tail -200 a.txt :读取a.txt 文件的后两百行

tail -f a.txt 实时读取a.txt文件

head -10 a.txt :读取a.txt文件的前10行

技术分享图片

 

原文:https://www.cnblogs.com/maxforb/p/12580321.html

评论(0
© 2014 bubuko.com 版权所有 - 联系我们:wmxa8@hotmail.com
打开技术之扣,分享程序人生!