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