linux 实时显示文件的内容

1. watch -n 1 aa.txt  #每个1秒显示aa.txt的内容

 

2. tail -f ***.log

Linux shell中有一个tail命令,常用来显示一个文件的最后n行文档内容

但更多情况下,我们要在服务器端运行程序,并且需要实时监控运行日志,这时候有什么办法实时滚动显示log文件内容?

这里可以利用tail命令加参数f实现,具体用法如下:

tail -f ***.log

参数说明-f, --follow[={name|descriptor}]:output appended data as the file grows; -f, --follow, and --follow=descriptor are equivalent
 
tail其它参数运行 man tail 查看