Skip to content
shellmap

catPrint file contents to standard output across all 5 shells

Equivalents in every shell

Bashunix
cat file.txt
Zshunix
cat file.txt
Fishunix
cat file.txt
PowerShellwindows
Get-Content file.txt

Aliased as `cat`, `gc`, and `type`.

cmd.exewindows
type file.txt

Concatenate multiple files with `copy file1+file2 con`.

Worked examples

Show a file

Bash
cat README.md
PowerShell
Get-Content README.md
cmd.exe
type README.md

Concatenate two files into a third

Bash
cat a.txt b.txt > c.txt
PowerShell
Get-Content a.txt, b.txt | Set-Content c.txt
cmd.exe
copy a.txt+b.txt c.txt

Follow / tail a growing file

Bash
tail -f app.log
PowerShell
Get-Content app.log -Wait -Tail 10
cmd.exe
powershell Get-Content app.log -Wait

Gotchas

  • `Get-Content` returns an array of strings — useful in pipelines, but slower than `[System.IO.File]::ReadAllText` for huge files.
  • cmd `type` cannot follow / tail; for `tail -f` behavior on Windows use PowerShell `Get-Content -Wait`.

WSL & PowerShell Core notes

pwshOn Linux/macOS PowerShell Core, the `cat` and `type` aliases for `Get-Content` are removed — `cat file.txt` resolves to `/bin/cat`. On Windows pwsh, the aliases still win. For portable scripts, call `Get-Content` directly.
WSLReading `/mnt/c/...` files preserves Windows CRLF line endings; downstream tools that split on `\n` will see a stray `\r`. Pipe through `tr -d "\r"` or use `dos2unix` to normalize before further processing.

Common tasks using cat

Related commands