码迷,mamicode.com
首页 > 系统相关 > 详细

linux 实时显示文件的内容

时间:2018-03-09 20:35:04      阅读:204      评论:0      收藏:0      [点我收藏+]

标签:shell   follow   显示文件   log文件   file   tor   tput   lin   rip   

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 查看
 
 

linux 实时显示文件的内容

标签:shell   follow   显示文件   log文件   file   tor   tput   lin   rip   

原文地址:https://www.cnblogs.com/fps2tao/p/8535519.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!