1.释义
从文件内容的尾行开始查看,默认查看倒数10行,tail -f/tailf效果一样
2.系统帮助
用法:tail [选项]... [文件]...
将每个文件的最后10行打印到标准输出。
对于多个文件,在每个文件前面加上一个给出文件名的头。
如果没有文件,或者文件为-,则读取标准输入。
长选项的强制参数对于短选项也是强制的。
-c, --bytes=K output the last K bytes; or use -c +K to output
bytes starting with the Kth of each file
-f, --follow[={name|descriptor}]
动态跟踪,当文件内容发生改变时立即更新;
an absent option argument means 'descriptor'
-F same as --follow=name --retry
-n, --lines=K 指定输出行数,可以使用-n 3或是-3, 不加默认显示10行;
or use -n +K to output starting with the Kth
--max-unchanged-stats=N
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
--pid=PID with -f, terminate after process ID, PID dies
-q, --quiet, --silent never output headers giving file names
--retry keep trying to open a file if it is inaccessible
-s, --sleep-interval=N with -f, sleep for approximately N seconds
(default 1.0) between iterations;
with inotify and --pid=P, check process P at
least once every N seconds
-v, --verbose always output headers giving file names
--help显示此帮助信息并退出
--version显示版本信息并退出
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 定期追踪打开给定名称的文件,以确认它是否被删除或被其它某些程序重新创建过。
GNU coreutils online help:
请向 报告tail 的翻译错误
要获取完整文档,请运行:info coreutils 'tail invocation'
3.示例
显示passwd内容,默认后10行
tail /etc/passwd | nl
动态跟踪messages文件内容最后3行的变化信息
tail -n 3 -f /var/log/messages
IT博客站版权所有丨如未注明 , 均为原创丨本网站采用BY-NC-SA协议进行授权
转载请注明原文链接:tail从文件内容的尾行开始查看命令