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