1.查看實時日志文件
tail -f catalina.out
2.實時查看日志文件 最后n行
tail -n 200 -f catalina.out
3.退出tail命令
ctrl + C
4.翻頁查看 日志文件
less catalina.out :G //回到文本末尾 page up //向上翻頁 page down //向下翻頁
5.tail高亮展示關鍵詞
【此功能,可以在使用xshell的使用,直接在頁面搜索 就可以,不用這么復雜的命令】
tail -n 200 -f dpe_partner_all.log | perl -pe 's/(關鍵詞)/\e[1;31m$1\e[0m/g'
例如高亮顯示ERROR
tail -n 200 -f dpe_partner_all.log | perl -pe 's/(ERROR)/\e[1;31m$1\e[0m/g'