69、linux shell常用函数,tail

1、tail - output the last part of files

tail [OPTION][+/-num]... [FILE]...

2、option

① -f,:output appended data as the file grows;

② -s, :with -f, sleep for S seconds (default 1.0) between iterations.

③ -n, :output the last N lines, instead of the last 10

④ -c :output the last N bytes

第二条常用于跟踪日志,显示日志的新增信息

说明:

① + num 从第 num行以后开始显示。

② - num 从距文件尾 num行处开始显示。

3、示例

tail -n 3 file //等价于tail -3 file

tail -n +3 file //从第3行以后显示,tail +3 file

tail -f file

tail -f -s 2 file

参考

【1】 http://linux.die.net/man/1/tail

【2】 https://wangyan.org/blog/linux-head-tail.html

【3】 http://blog.csdn.net/carzyer/article/details/4759593

posted @ 2011-10-31 08:23  浪里飞  阅读(3464)  评论(0)    收藏  举报