PowerShell vs Bash comes down to one idea: PowerShell passes objects down the pipeline, while Bash passes plain text. Here’s the same filter in both:
Get-ChildItem | Where-Object Length -gt 1KB # PowerShell: filter a property
ls -l | awk '$5 > 1024' # Bash: filter column 5 of text
In this tutorial, we’ll run the same everyday jobs side by side in PowerShell 7, Windows PowerShell 5.1 and Bash (Git Bash on Windows).
PowerShell vs Bash at a glance
Bash is the default shell on most Linux systems. PowerShell is Microsoft’s shell; Windows PowerShell 5.1 ships with Windows, and PowerShell 7 runs on Windows, Linux and macOS.
| Feature | PowerShell | Bash |
|---|---|---|
| Pipeline data | Objects with properties | Lines of text |
| Commands | Verb-Noun cmdlets (Get-ChildItem) | Small programs (ls, grep, awk) |
| Variables | $city = "Austin" | city="Austin" (no spaces) |
| String compare | -eq, case-insensitive | = inside [ ], case-sensitive |
| CSV / JSON | Import-Csv, ConvertFrom-Json built in | awk, cut, or jq (separate tool) |
| Exit status | $? is True/False, plus $LASTEXITCODE | $? is a number (0 = success) |
| && and || | PowerShell 7 only | Always |
| Home platform | Windows (7 is cross-platform) | Linux and macOS |
If you’re coming from the Windows side, my comparison of Windows PowerShell vs CMD covers the older Command Prompt too.
The sample files we’ll use
Every example uses one folder, west-sales, with three log files (640, 2,048 and 5,120 bytes) and this orders.csv:
OrderId,Customer,City,Amount
1001,Maria Lopez,Austin,1250.00
1002,Tom Baker,Denver,320.50
1003,Dana Reyes,Seattle,780.00
1004,Chris Hall,Austin,95.25
Plus a small config.json:
{
"region": "West",
"owner": "Dana Reyes",
"targets": {
"q4": 50000
},
"cities": [
"Austin",
"Denver",
"Seattle"
]
}
Difference 1: Objects vs text in the pipeline
Let’s list the log files over 1 KB, largest first. PowerShell filters and sorts on a named property:
Get-ChildItem .\west-sales\logs |
Where-Object Length -gt 1KB |
Sort-Object Length -Descending |
Select-Object Name, Length
Output:
Name Length
---- ------
mar.log 5120
feb.log 2048

The Bash version reads the text that ls -l prints and picks columns by position:
ls -l west-sales/logs | awk '$5 > 1024 { print $9, $5 }' | sort -k2 -nr
Output:
mar.log 5120
feb.log 2048
