1. 程式人生 > >Windows 下 tail 檢視日誌命令工具分享

Windows 下 tail 檢視日誌命令工具分享

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裡還包含了很多有用的工具,其它的不進行介紹了,自已去挖掘:)

注:

使用方法:

下載後解壓,把tail.exe 複製到 目錄:C:\Windows\System32 下

直接輸命令就可以了:




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下載,免得去下載安裝或解壓了