Scroll to navigation

TAIL(1) 使用者命令 TAIL(1)

名稱

tail - 輸出檔案的末尾部分

概述

tail [選項]... [檔案列表]...

描述

將檔案列表中每個檔案的倒數10行內容輸出至標準輸出。如果指定多個檔案,則會在每個檔案的部分之前新增給定檔名稱。

如果沒有指定檔案,或者指定檔案為“-”,則從標準輸入讀取。

必選引數對長短選項同時適用。

輸出最後 NUM 個位元組;或者使用 -c +NUM 輸出每個檔案從第 NUM 個位元組開始的資料
隨檔案增長即時輸出新增資料;
若未給定選項引數,則預設使用 'descriptor'
--follow=name --retry 相同
output the last NUM lines, instead of the last 10; or use -n +NUM to output starting with line NUM
with --follow=name, reopen a FILE which has not
changed size after N (default 5) iterations to see if it has been unlinked or renamed (this is the usual case of rotated log files); with inotify, this option is rarely useful
-f 同時使用時,在程序號為 PID 的程序結束後終止執行
不輸出含有檔名的頭
如果檔案無法訪問,一直重複嘗試開啟檔案
-f 同時使用時,在兩次迭代之間睡眠約 N 秒(預設 1.0 秒);核心支援 inotify 且使用了 --pid=P 時,每 N 秒至少檢查一次程序 P
總是輸出含有檔名的頭
以 NUL 作為行的分隔符,而非換行符
顯示此幫助資訊並退出
顯示版本資訊並退出

NUM 後面可以加上乘數字尾:b 512、kB 1000、K 1024、MB 1000*1000、M 1024*1024, GB 1000*1000*1000、G 1024*1024*1024,T、P、E、Z、Y 以此類推。 也可以使用二進位制字首:KiB=K、MiB=M,以此類推。

With --follow (-f), tail defaults to following the file descriptor, which means that even if a tail'ed file is renamed, tail will continue to track its end. This default behavior is not desirable when you really want to track the actual name of the file, not the file descriptor (e.g., log rotation). Use --follow=name in that case. That causes tail to track the named file in a way that accommodates renaming, removal and creation.

作者

由 Paul Rubin、David MacKenzie 和 Jim Meyering 編寫。

報告錯誤

GNU coreutils 的線上幫助: <https://www.gnu.org/software/coreutils/>
請向 <https://translationproject.org/team/zh_CN.html> 報告翻譯錯誤。

版權

Copyright © 2022 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html>.
本軟體是自由軟體:您可以自由修改和重新發布它。在法律允許的範圍內,不提供任何保證。

參見

head(1)

完整文件請見:<https://www.gnu.org/software/coreutils/tail>
或者在本地使用: info '(coreutils) tail invocation'

本頁面中文版由中文 man 手冊頁計劃提供。
中文 man 手冊頁計劃:https://github.com/man-pages-zh/manpages-zh

2022年9月 GNU coreutils 9.1