tail命令
用法:tail [選項]… [文件]…
Print the last 10 lines of each FILE to standard output.
With more than one FILE, precede each with a header giving the file name.
With no FILE, or when FILE is -, read standard input.
Mandatory arguments to long options are mandatory for short options too.
-f 循環讀取
-q 不顯示處理信息
-v 顯示詳細的處理信息
-c<數目> 顯示的字節數
-n<行數> 顯示行數
–pid=PID 與-f合用,表示在進程ID,PID死掉之後結束.
-q, –quiet, –silent 從不輸出給出文件名的首部
-s, –sleep-interval=S 與-f合用,表示在每次反覆的間隔休眠S秒
If the first character of K (the number of bytes or lines) is a ‘+’,
print beginning with the Kth item from the start of each file, otherwise,
print the last K items in the file. K may have a multiplier suffix:
b 512, kB 1000, K 1024, MB 1000*1000, M 1024*1024,
GB 1000*1000*1000, G 1024*1024*1024, and so on for T, P, E, Z, Y.
如果您希望即時追查一個文件的有效名稱而非描述內容(例如循環日誌),默認
的程序動作並不如您所願。在這種場合可以使用–follow=name 選項,它會使
tail 定期追蹤打開給定名稱的文件,以確認它是否被刪除或被其它某些程序重新創建過。
下面給出例子:
顯示文件最後5行內容