A Windows equivalent of the Unix tail command [clo

2019-01-01 06:23发布

I'm looking for the equivalent of the Unix 'tail' command that will allow me to watch the output of a log file while it is being written to.

标签: windows tail
26条回答
君临天下
2楼-- · 2019-01-01 07:01

Graphical log viewers, while they might be very good for viewing log files, don't meet the need for a command line utility that can be incorporated into scripts (or batch files). Often such a simple and general-purpose command can be used as part of a specialized solution for a particular environment. Graphical methods don't lend themselves readily to such use.

查看更多
无色无味的生活
3楼-- · 2019-01-01 07:02

If you use PowerShell then this works:

Get-Content filenamehere -Wait -Tail 30

Posting Stefan's comment from below, so people don't miss it

PowerShell 3 introduces a -Tail parameter to include only the last x lines

查看更多
骚的不知所云
4楼-- · 2019-01-01 07:03

I prefer TailMe because of the possibility to watch several log files simultaneously in one window: http://www.dschensky.de/Software/Staff/tailme_en.htm

查看更多
妖精总统
5楼-- · 2019-01-01 07:04

You can get tail as part of Cygwin.

查看更多
人气声优
6楼-- · 2019-01-01 07:05

I haven't seen Log Expert anywhere among answers here.

It's customizable and is quite good for going around log files. So far it's the best Windows graphical log viewer for me.

查看更多
还给你的自由
7楼-- · 2019-01-01 07:06

There are quite a number of options, however all of them have flaws with more advanced features.

  • The Windows Server 2003 Tools provides a simple tail that can be downloaded with the Resource Kit Tools. It is too limited in many respects (locks followed file, lacks many options like --pid), however will do for the basic task of tracking a file.

  • GnuWin32 tail is buggy (α β γ) - things like -f just plain don't work.

  • UnxUtils tail seems better (-f works, but --pid seems not to, -n but not --lines=n fails with -f), but appears to be a dead project.

  • Cygwin is a big ugly mush, could perhaps just use the DLL and coreutils package - but still has problems like --pid not working with native win32 processes.

查看更多
登录 后发表回答