顯示檔案的最後幾行(tail 指令)
使用 tail 指令,可以將 File 參數所指定的檔案, 從指定的地方開始寫入標準輸出。
請參閱下列範例:
- 若要顯示 notes 檔案的最後十行,請鍵入:
tail notes
- 若要指定從 notes 檔案尾端開始讀取的行數,請鍵入:
tail -20 notes
- 若要一次一頁、從第 200 個位元組開始顯示 notes 檔案,請鍵入:
tail -c +200 notes | pg
- 若要追蹤檔案 accounts 的成長情況,請鍵入:
此指令會把 accounts 這個檔案內容的最後 10 行顯示出來。此 tail 指令會在字行附加到 accounts 檔案時,持續顯示它們。它會一直顯示到您按下 (Ctrl-C) 鍵順序,才會停止顯示。tail -f accounts
請參閱 Commands Reference, Volume 5 中的 tail 指令,以取得完整語法。