首页 > 其他 > 详细

tailf 跟踪日志文件

时间:2018-04-25 23:35:14      阅读:922      评论:0      收藏:0      [点我收藏+]

1.命令功能

tailf 跟踪日志文件增长,作用跟tail –f相同。tailf将输出文件的最后10行,然后等待文件增长。

2.语法格式

tailf  option  file

参数说明

参数

参数说明

-n

指定显示文件最后的行数(默认显示最后10行)

3.使用范例

范例1 tailf 跟踪日志

[root@localhost chu]# tailf /var/log/messages

Apr 24 04:04:44 localhost sshd[1410]: error: Bind to port 22 on 0.0.0.0 failed: Address already in use.

Apr 24 04:04:44 localhost sshd[1410]: error: Bind to port 22 on :: failed: Address already in use.

Apr 24 04:04:44 localhost sshd[1410]: fatal: Cannot bind any address.

Apr 24 04:20:55 localhost sshd[1429]: Accepted password for root from 172.16.2.100 port 3895 ssh2

Apr 24 04:21:04 localhost sftp-server[1444]: error: Unknown extended request "fs-multiple-roots-supported@vandyke.com"

Apr 24 04:21:04 localhost sftp-server[1444]: error: Unknown extended request "openex@vandyke.com"

Apr 24 04:21:04 localhost sftp-server[1444]: error: Unknown extended request "vendor-id"

Apr 24 04:22:44 localhost sshd[1467]: Accepted password for root from 172.16.2.100 port 4045 ssh2

Apr 24 04:22:47 localhost sshd[1482]: Accepted password for root from 172.16.2.100 port 4048 ssh2

Apr 24 04:23:03 localhost sshd[1498]: Accepted password for root from 172.16.2.100 port 4063 ssh2

范例2 显示最后4行

[root@localhost chu]# tailf -4 /var/log/messages

Apr 24 04:21:04 localhost sftp-server[1444]: error: Unknown extended request "vendor-id"

Apr 24 04:22:44 localhost sshd[1467]: Accepted password for root from 172.16.2.100 port 4045 ssh2

Apr 24 04:22:47 localhost sshd[1482]: Accepted password for root from 172.16.2.100 port 4048 ssh2

Apr 24 04:23:03 localhost sshd[1498]: Accepted password for root from 172.16.2.100 port 4063 ssh2

tailf 跟踪日志文件

原文:https://www.cnblogs.com/joechu/p/8947465.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!