ITPub博客

首页 > Linux操作系统 > Linux操作系统 > DOS下类似LINUX下的tail -f 功能的命令

DOS下类似LINUX下的tail -f 功能的命令

原创 Linux操作系统 作者:qgrape 时间:2009-11-29 15:01:56 0 删除 编辑
 

DOS下有类似LINUX下的tail -f 功能的命令,可以实时监控文本文件,可以实现,不过得安装一个小的程序。

http://www.microsoft.com/downloads/details.aspx?familyid=9d467a69-57ff-4ae7-96ee-b18c4790cffd&displaylang=en

下载后安装,打开command shell,

C:\Program Files\Windows Resource Kits\Tools>tail /?
usage: TAIL [switches] [filename]*
   switches: [-?] display this message
             [-n] display last n lines of each file (default 10)
             [-f filename] keep checking filename for new lines

C:\Program Files\Windows Resource Kits\Tools>tail -f e:\1.txt
col event for a28;
col wait_class for a10;
SELECT EVENT,
       WAIT_CLASS,
       SUM(DECODE(WAIT_TIME, 0, 0, 1)) PREV,
       SUM(DECODE(WAIT_TIME, 0, 1, 0)) CURR,
       COUNT(*)
FROM V$SESSION_WAIT
GROUP BY EVENT, WAIT_CLASS
ORDER BY 4 DESC;
fd
fd

向1.txt加了几个字符,保存,确实可以实时监控。

Kit Tools里还包含了很多有用的工具

-------------------------------------------------------------------------------------------------

Windows下的tail一二三:tail、BareTail、WinTail
在Windows下查看输了的日志log的文件,使用UE或Edit plus可以知道文件改变了,但是光标都会回到文件头部去,很不方便,用记事本就更不用说了。
如何才能在Windows下象在Linux使用tail一样方便地来查看日志呢?
1、Windows Server 2003 Resource Kit Tools
http://www.microsoft.com/downloads/details.aspx?familyid=9d467a69-57ff-4ae7-96ee-b18c4790cffd&displaylang=en
http://download.microsoft.com/download/8/e/c/8ec3a7d8-05b4-440a-a71e-ca3ee25fe057/rktools.exe
但是这个下载后的文件却是要求Windows XP系统之类的,我用的是Win2K,晕,当然有方法来绕过它了。
还是先下载文件,用WinRAR可以解开它,成三个文件:rktools.msi、rktools_p.cab和rktools_s.cab
rktools.msi安装包是所有的工具集的安装文件,用7-Zip直接解压打开就可以看到里面的文件了,比如解压到C:\DOS目录下
rktools_p.cab和rktools_s.cab文件里包含一个rktools.chm的使用帮助文件,同样用7-Zip来打开,用WinRAR或者WinCAB也可以打开
使用:
C:\DOS>tail/? 一成不变的方法,/?来查看使用帮助
usage: TAIL [switches] [filename]*
   switches: [-?] display this message
             [-n] display last n lines of each file (default 10)
             [-f filename] keep checking filename for new lines
示例:
tail xxx.log 查看文件,默认显示最后的10行
tail -100 xxx.log 显示最后的100行
tail -f xxx.log 一直查看文件的变化。

Kit Tools里还包含了很多有用的工具,其它的不进行介绍了,自已去挖掘:)

2、BareTail : A free real-time log file monitoring tool,有Free Version
http://www.baremetalsoft.com/baretail/index.php
也有专业版的BareTailPro,要收费的 :
http://www.baremetalsoft.com/baretailpro/index.php

3、WinTail : Hoo的商业WinTail软件,Hoo WinTail is a real-time log monitor and viewer for Windows like the UNIX tail -f utility.
http://www.hootech.com/WinTail/

建议用BareTail或Windows的tail.exe,基本上可以满足我们的日常需要。
附上Windows Server 2003 Resource Kit Tools的tail.exe下载,免得去下载安装或解压了。

 

 

 

 

 

 

 

 

 

 

 

来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/12330444/viewspace-620921/ ,如需转载,请注明出处,否则将追究法律责任。

上一篇: EMCA常用命令
请登录后发表评论 登录
全部评论

注册时间:2008-04-09

  • 博文量
    223
  • 访问量
    560980