追天网站建设 优帮云,网页设计基础入门,网页设计薪资多少,jsp网站开发案例tail 命令从指定点开始将文件写到标准输出.使用tail命令的-f选项可以方便的查阅正在改变的日志文件,tail -f filename会把filename里最尾部的内容显示在屏幕上,并且不但刷新,使你看到最新的文件内容. 1#xff0e;命令格式; tail[必要参数][选择参数][文件] 2#xff0e;… tail 命令从指定点开始将文件写到标准输出.使用tail命令的-f选项可以方便的查阅正在改变的日志文件,tail -f filename会把filename里最尾部的内容显示在屏幕上,并且不但刷新,使你看到最新的文件内容. 1命令格式; tail[必要参数][选择参数][文件] 2命令功能 用于显示指定文件末尾内容不指定文件时作为输入信息进行处理。常用查看日志文件。 3命令参数 -f 循环读取 -q 不显示处理信息 -v 显示详细的处理信息 -c数目 显示的字节数 -n行数 显示行数 --pidPID 与-f合用,表示在进程ID,PID死掉之后结束. -q, --quiet, --silent 从不输出给出文件名的首部 -s, --sleep-intervalS 与-f合用,表示在每次反复的间隔休眠S秒 4使用实例 实例1显示文件末尾内容 命令 tail -n 5 log2014.log 输出 [rootlocalhost test]# tail -n 5 log2014.log 2014-09 2014-10 2014-11 2014-12 [rootlocalhost test]# 说明 显示文件最后5行内容 实例2循环查看文件内容 命令 tail -f test.log 输出 [rootlocalhost ~]# ping 192.168.120.204 test.log [1] 11891[rootlocalhost ~]# tail -f test.log PING 192.168.120.204 (192.168.120.204) 56(84) bytes of data. 64 bytes from 192.168.120.204: icmp_seq1 ttl64 time0.038 ms 64 bytes from 192.168.120.204: icmp_seq2 ttl64 time0.036 ms 64 bytes from 192.168.120.204: icmp_seq3 ttl64 time0.033 ms 64 bytes from 192.168.120.204: icmp_seq4 ttl64 time0.027 ms 64 bytes from 192.168.120.204: icmp_seq5 ttl64 time0.032 ms 64 bytes from 192.168.120.204: icmp_seq6 ttl64 time0.026 ms 64 bytes from 192.168.120.204: icmp_seq7 ttl64 time0.030 ms 64 bytes from 192.168.120.204: icmp_seq8 ttl64 time0.029 ms 64 bytes from 192.168.120.204: icmp_seq9 ttl64 time0.044 ms 64 bytes from 192.168.120.204: icmp_seq10 ttl64 time0.033 ms 64 bytes from 192.168.120.204: icmp_seq11 ttl64 time0.027 ms [rootlocalhost ~]# 说明 ping 192.168.120.204 test.log //在后台ping远程主机。并输出文件到test.log这种做法也使用于一个以上的档案监视。用Ctrlc来终止。 实例3从第5行开始显示文件 命令 tail -n 5 log2014.log 输出 [rootlocalhost test]# cat log2014.log 2014-01 2014-02 2014-03 2014-04 2014-05 2014-06 2014-07 2014-08 2014-09 2014-10 2014-11 2014-12 [rootlocalhost test]# tail -n 5 log2014.log 2014-05 2014-06 2014-07 2014-08 2014-09 2014-10 2014-11 2014-12