≡ Menu

Tail command for Windows (CMD)

Tail is Windows Resource kit command, which is used from command prompt to print last ‘N’ lines of any text file.

Download tail command

Firstly download Windows resource kit from here
Open the downloaded file. It installs the tools in the default directory C:\Program Files\Windows Resource Kits\Tools

Tail command usage

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

Examples:

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 more data is being written to them. Tail command with -f option does not terminate until the user presses [Ctrl]-[C].

9 comments… add one
  • Anurag

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

  • Ameya

    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

    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?

    Thanks;

  • Sungsoo Kim

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

    See Below

    C:\afile>dir /b /od | tail -1
    cmd.txt
    
    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
    cmd.txt
    
    C:\afile>dir /b /od | tail -1
    cmd.txt
  • annie

    Where can I download Windows resource kit ?

  • Maran

    The link to download the tail cmd does not work anymore

    • Srini

      Thank for pointing that out. Updated with the link that is working.

Leave a Comment