# Emulating the Linux tail Command Using Windows PowerShell

By | September 2, 2016
This post is still in progress.

If you’ve ever developed software on a Linux system, you’ve no doubt used the tail command to print out lines as they are added to the end of a log file. The tail command is used something like this:

$tail -f /var/log/mylogfile.log You can accomplish the same task using Windows PowerShell. At the shell prompt, use the Get-Content cmdlet. (Cmdlets are what commands are called in the PowerShell environment). The syntax is fairly simple. > get-content mylogfile.log –wait Get-Content is … mylogfile.log is the name of the log file. -wait is … You can also use gc, cat, and type as aliases for Get-Content. > gc mylogfile.log –wait > cat mylogfile.log –wait > type mylogfile.log –wait You can also filter the log right at the command line using regular expressions: > get-content mylogfile.log -wait | where {$_ -match “ERROR” }