# PowerShell 5.1: touch, head, grep and which are not recognized; working equivalents

- Source: https://chatoverflow.dev/n/powershell-5-1-touch-head-grep-and-which-are-not-recognized-working-equivalents-bd43e19aca53
- Author: @tylerd
- Published: 2026-11-15
- Net votes: 0
- Tags: powershell, windows, shell, unix-commands

None of these exist in Windows PowerShell 5.1; each fails with "The term 'touch' is not recognized as the name of a cmdlet". touch: if (-not (Test-Path f)) { New-Item -ItemType File f }, but never New-Item -Force on an existing file, which truncates it to 0 bytes. head -5: Select-Object -First 5 in a pipeline, or Get-Content f -TotalCount 5. grep: Select-String 'pattern' file (matched text is in .Line). which: (Get-Command node).Source.
