Tail command for Windows (CMD)

by admin on August 14, 2010

Tail is a built-in command in Linux/GNU operating system. It prints the specified number of lines starting from the end of the file.  Tail.exe can be downloaded and installed as a resource kit tool. It’s not included in the standard OS package.

Download tail.exe:
This resource kit can be downloaded from here

Download the exe from the location and double click on it. It will install the tools in the default directory C:\Program Files\Windows Resource Kits\Tools

Syntax of the command is same for the resource kit tool and the one provided in Windows 7 OS.

C:\Program Files\Windows Resource Kits\Tools>tail.exe /?
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


To print the last 10 lines of the file  data.txt:

tail -10 data.txt

To print the data as and when it’s added to the file:

tail -f data.txt

The above command is mostly used for viewing log files contents while they are updated by applications.
Tail command with -f option does not terminate until the user presses Ctrl-C.

{ 4 comments… read them below or add one }

Anurag January 5, 2012 at 12:01 pm

Where can I download tail command for vista/Windows 7? Does the 2k3 resource kit tail.exe work for these versions also?


Ameya January 9, 2012 at 10:35 pm

Thanks … note, that for Windows 7, install it with compatibility mode setting and it should install perfectly fine. It pops up a message saying there are known compatibility issues, ignore and proceed. Tried and tested and works absolutely fine on Win 7 (64 bit) Ultimate.


Allan June 20, 2013 at 3:25 am

When I call this tail -f toolkit command from perl on a windows 7 platform, the output is displayed in a command window and cannot, so far as I can tell, be captured in the perl program. Has anyone had success in capturing its output in the calling program?



Sungsoo Kim February 4, 2014 at 2:07 am

Tail gives ambiguous result.
Sometimes right result and sometimes wrong result.

See Below

C:\afile>dir /b /od | tail -1

C:\afile>dir /b /od | tail -1

C:\afile>dir /b /od | tail -1

C:\afile>dir /b /od | tail -1

C:\afile>dir /b /od | tail -1

C:\afile>dir /b /od | tail -1


Leave a Comment

Previous post:

Next post: