Tail a log file live with Get-Content -Tail -Wait

PowerShell's built-in tail -f — show the last N lines and keep streaming new ones as the log grows.

WindowslogsFilespowershellLow risk
Run Get-Content '<logfile>' -Tail 20 -Wait to show the last 20 lines and print new lines live until you press Ctrl+C.

01Command

Command
$ Get-Content 'C:\Logs\app.log' -Tail 20 -Wait

02What it does

-Wait polls the file roughly once per second and emits appended lines, so it behaves like tail -f; -Tail controls the starting window. Since output is the normal pipeline you can filter live: ... -Wait | Select-String 'ERROR'. -Tail also works without -Wait for a one-shot look at the end of a huge file.

03Risk

RiskLow risk
RequirementsPowerShell
!Warning: -Wait never exits on its own — use Ctrl+C to stop; it also won't follow a file that gets deleted and recreated by log rotation.

04Undo

✓No undo needed — this command does not change persistent state.

05Sources

  • Get-Content - PowerShell
    SS64 · technical · 2026-09-17
    Evidence: SS64 lists -Tail and -Wait parameters, noting -Wait polls the file and outputs new lines when added.
  • Get-Content | Microsoft Learn
    Microsoft · vendor-doc · 2026-09-17
    Evidence: Microsoft documents Get-Content -Tail <n> to return the last n lines and -Wait to keep the file open and emit new lines as they are appended.

Last verified: 2026-09-17 · Category: Files & Folders

06Related solutions