The native PS equivalent since PSv3 is
Get-Content -Last n
which is also fast. In PSv2 and below you have to make do with
Get-Content filename | Select -Last n
but that has several caveats. It cannot block and wait for new changes to the file for example and is also not very efficient in that it has to read the file from the start completely before being able to show the last lines.
PSCX has a
Get-FileTail command which has a
PSCX Cmdlet: Tails the contents of a file - optionally waiting on new content.
Get-FileTail [-Path] <String> [-Count <Int32>] [-Encoding <EncodingParameter>] [-LineTerminator <String>]
Get-FileTail [-LiteralPath] <String> [-Count <Int32>] [-Encoding <EncodingParameter>] [-LineTerminator <String>]
This implentation efficiently tails the cotents of a file by reading lines from the end rather then processing the entire file. This behavior is crucial for efficiently tailing large log files and large log files over a network. You can also specify the
Wait parameter to have the cmdlet wait and display new content as it is written to the file. Use Ctrl+C to break out of the wait loop. Note that if an encoding is not specified, the cmdlet will attempt to auto-detect the encoding by reading the first character from the file. If no character haven't been written to the file yet, the cmdlet will default to using Unicode encoding. You can override this behavior by explicitly specifying the encoding via the Encoding parameter.
Get-FileTail is aliased to
tail by default if you install PSCX.