Terminal Dojo
Help العربية Sign inGet started

Command library / Get-Content

Get-Content

PowerShellDraft — pending expert review4 practice missions

Print a file's contents as objects

PowerShell's file reader — the same job bash's cat and cmd's type do, but each line comes back as a real object you can pipe onward. -Tail is the one every incident responder reaches for: only the last N lines, without loading a huge file.

Practice Get-Content

Usage

Get-Content [[-Path] <string>] [-TotalCount <int>] [-Tail <int>] [-Wait]

Options and flags

Examples

Common mistakes

Get-Content -Tail 20 Get-Content app.log -Tail 20

-Tail only trims what Get-Content already read — it still needs a file to read in the first place.

Related commands

get-childitemget-winevent