linux显示一列数据的首尾行,tail从文件内容的尾行开始查看命令

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

833.html

动态跟踪messages文件内容最后3行的变化信息

tail -n 3 -f /var/log/messages

833.html

IT博客站版权所有丨如未注明 , 均为原创丨本网站采用BY-NC-SA协议进行授权

转载请注明原文链接:tail从文件内容的尾行开始查看命令

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值