命令行查看日志

复制代码
tail -f test.log 实时监控日志
tail -100f test.log 实时监控100行日志
tail -n 10 test.log 查看最后10行日志
tail -n +10 test.log 查看文件中行号10后边的日志


head -n 10 test.log 查看前10行日志
head -n -10 test.log 查看文件中行号10前边的日志


查找日志

1.查询关键字相关日志
cat -n test.log | grep 关键字

2.比如上边查出来后,要看2274行附近日志。根据上边的行号(2274),(tail -n +2274)查询行号2274后的日志,( head -n 20)然后再从结果中查前50条
cat -n test.log | tail -n +2274 | head -n 50
复制代码

 

posted @   新手娃娃菜  阅读(32)  评论(0编辑  收藏  举报
(评论功能已被禁用)
相关博文:
阅读排行:
· 地球OL攻略 —— 某应届生求职总结
· 周边上新:园子的第一款马克杯温暖上架
· Open-Sora 2.0 重磅开源!
· 提示词工程——AI应用必不可少的技术
· .NET周刊【3月第1期 2025-03-02】
历史上的今天:
2019-05-07 邮件发送接收工具
点击右上角即可分享
微信分享提示