Bash <-> PowerShell Translator

Translate Bash one-liners to PowerShell and vice versa using a rules table.

Paste a one-liner to translate.
Rules reference
BashPowerShell
lsGet-ChildItem
ls -laGet-ChildItem -Force
catGet-Content
grepSelect-String
find . -name *.csGet-ChildItem -Recurse -Filter *.cs
rm -rf pathRemove-Item -Recurse -Force path
cp src dstCopy-Item src dst
mv src dstMove-Item src dst
mkdir -p a/bNew-Item -ItemType Directory -Force a/b
touch fNew-Item -ItemType File f
head -n 5Select-Object -First 5
tail -n 5Select-Object -Last 5
echo hiWrite-Output hi
export VAR=x$env:VAR = 'x'
$VAR$env:VAR
cmd > outcmd > out
cmd >> outcmd >> out
cmd 2>&1cmd 2>&1
a && ba; if ($?) { b } (PS 5.1)
a || ba; if (-not $?) { b } (PS 5.1)
$(cmd)$(cmd)

About this tool

Paste a one-liner in either Bash or PowerShell and convert it to the other shell. Covers ls/Get-ChildItem, cat/Get-Content, grep/Select-String, find/Get-ChildItem -Recurse, rm/Remove-Item, env vars, head/tail, redirections and &&/|| chaining (note: PS 5.1 has no native &&/||).

An unhandled error has occurred. Reload ×