Windows XP and DOS

Unix Style Tail Command

SUMMARY: Display the most recent results of a log file with the tail command for Windows XP.


The tail command, on most Unix-style operating systems, lets you display the last 10 or so lines of a text file. Tail also supports a feature allowing you to display new lines as they appear in the file. This feature of tail is most commonly used for displaying the results of log or debug files, letting you see only the most recent activity of a particular process.

While Windows XP does not normally come with a 'tail' tool, it is available in the Windows 2003 Resource Kit. It is a large download, but besides the 'tail' command, the Windows 2003 Resource Kit also provides tools to remap keys, query the Active Directory, and more. To download and install the Resource Kit:

1. Go to the Microsoft Windows Server 2003 download section at http://www.microsoft.com/windowsserver2003/
downloads/tools/default.mspx
. Or, if that link does not work, visit http://www.microsoft.com/ and search for "Windows 2003". Once there, choose the "Downloads -> Tools" link.

2. Select the link "Windows Server 2003 Resource Kit Tools".

3. Click the "Download" link. Choose to register or not, depending on your choice, and follow the on-screen instructions to download and install the product. The default install directory is "C:\Program Files\Windows Resource Kits\Tools\".

Once the Windows 2003 Resource Kit is installed, you may need to reboot your machine for the directory "C:\Program Files\Windows Resource Kits\Tools\" to be added to your path.

Now that the tail command is available, to see the online help, enter the following DOS command:

tail /?

Here is a command summary:

C:\>tail FILENAME

Display the last ten lines from file FILENAME. For example, to see the last ten activities made by the Windows Update tool, issue these commands:

C:\>c:
C:\>cd \windows
C:\>tail "Windows Update.log"

Other options:

C:\>tail -n FILENAME

Display the last 'n' lines from file FILENAME. For example, view the last 20 lines in the Windows Setup log:

C:\>c:
C:\>cd \windows
C:\>tail -20 setuplog.txt

C:\>tail -f FILENAME

Forces tail to keep accesing FILENAME, displaying new lines as necessary.

To see this feature in action, open up a new file in Notepad, write the word 'hello, world', and save it as c:\test.log. Keep the file open in Notepad. Now, issue the following DOS commands:

C:\>c:
C:\>cd \
C:\>tail -f test.log

You should see the word 'hello, world' in your DOS prompt. Now, go back to Notepad and write the text "Process executed." Save the file. The DOS prompt should now say "Process executed." Thanks to tail -f, whatever you add to the file in Notepad should then appear in your DOS prompt until you terminate the command.

Return to the Windows XP and DOS page.

Thanks For Sharing!

 

 

Newest Tips

Cell Phone
[MODIFIED] Six Battery Conservation Tips
Google Search Engine
What is My IP Address?
Mozilla Firefox - Misc
Missing the Title Bar? Menu Bar?
Windows 8
Bring Back the Mouse Pointer Drop Shadow

Follow/Contact Us!

   

About MalekTips and the Author

The MalekTips website was created in 1998 by of Envision Programming. The page's goal is to freely disperse computer-related tips, hints, and informative articles. Tips are organized to be easy to find, and are presented clearly, in easy-to-understand language.