Home > Microsoft, Powershell, Quickie > Quickie: Tail in Powershell

Quickie: Tail in Powershell

There is lots of great tools in Linux which are needed in Windows environment. One of the great tool from linux is “tail”. You can use it following way:

tail -f /var/log/mail.log

You will get end of the file and you see all content added to file on screen. You can view log files without need to reopen it. In Windows I use utility Trace32.exe. I was looking for some more native way to do it in Windows. There is a cmd-let Get-Content in Powershell which you can use following way:

Get-Content C:\Windows\WindowsUpdate.log -Wait -Tail 10

This tails only 10 lines from the end of the file and “waits” for new added lines. Switch “Tail” is accessible only in PowerShell 3 and higher.

Powershell is getting there,

  1. Milan Drobul
    March 4th, 2014 at 14:39 | #1

    very useful tip, thanks a lot

  2. March 4th, 2014 at 15:06 | #2

    @Milan Drobul
    You are welcome 😉
    It’s sad Linux had this in 1970s 🙂

  1. No trackbacks yet.