Skip to content
shellmap

Translate a command between shells

Paste any common shell command and see its equivalent in bash, zsh, fish, PowerShell, or cmd. Powered by 204 regex mappings — runs entirely in your browser, no signup, no AI.

From
To
Try a preset (bash → PowerShell)
ls -la
grep -r
find -name
cat file
tail -f
head -n
cp -r
rm -rf
mkdir -p
curl -O
ps | grep
kill -9
Paste a command
Translation

How it works

  • Pattern-matched, not LLM-generated. Each rule is a regular expression with a hand-written output template. Predictable and deterministic — the same input always produces the same output.
  • Both directions. Translate bash → PowerShell or PowerShell → bash, plus every other pair across the five supported shells.
  • Flag-aware. Rules recognize common flag variants (e.g. ls -la, rm -rf, grep -ri) and map each to the target's idiomatic equivalent.
  • Honest about gaps. When a command has no clean target-shell equivalent (e.g. chmod +x in PowerShell), the translator says so instead of inventing a fake rewrite.

Example translations

A few patterns the translator recognizes out of the box. Try them in the box above.

bash powershell
grep -r "TODO" .
Get-ChildItem . -Recurse | Select-String -Pattern "TODO"
bash powershell
ls -la /tmp
Get-ChildItem /tmp -Force
bash powershell
tail -n 100 app.log
Get-Content app.log -Tail 100
bash powershell
rm -rf node_modules
Remove-Item node_modules -Recurse -Force
powershell bash
Get-Process
ps aux
cmd bash
taskkill /f /pid 1234
kill -9 1234

Supported commands (39)

Commands the translator currently has at least one rule for. Each links to its full per-shell reference.

Plus rules for shell built-ins and other tools not yet documented as full pages — env, export, echo, alias, which, clear, whoami, hostname, uname, uptime, groups, id, exit, date, history, man, touch, less, more, df, du, sleep, seq, yes, watch, ln, readlink, basename, dirname, ssh-keygen, systemctl, apt, brew, nslookup, dig, traceroute, ifconfig, ip, ss, lsof, nc, sha256sum, md5sum, base64, nl, pgrep, nohup, crontab, and shell redirection / heredoc forms.

All translation rules

Every rule, grouped by canonical command. Each entry shows the operation the rule recognizes and the canonical bash form.

  • awk5 rules
    • Print column N of whitespace-separated input

      bash
      $1 | awk '{print $$2}'
    • Print the running line number

      bash
      $1 | awk '{print NR}'
    • Print the number of fields per line

      bash
      $1 | awk '{print NF}'
    • Print lines that match a regex (awk-style)

      bash
      awk '/$1/ {print}' $2
    • Pattern-action language (awk has no single PowerShell equivalent)

      bash
      awk
  • cat2 rules
    • Print file contents

      bash
      cat $1
    • cat heredoc — no single one-liner in PowerShell (use a here-string `@" ... "@`)

      bash
      cat <<$1
  • cd4 rules
    • Change to home directory

      bash
      cd ~
    • Move up one directory

      bash
      cd ..
    • Return to previous directory

      bash
      cd -
    • Change directory

      bash
      cd $1
  • chmod4 rules
    • Make a file executable

      bash
      chmod +x $1
    • Set file mode to 755 (owner rwx, group/other rx)

      bash
      chmod 755 $1
    • Recursively set numeric file mode

      bash
      chmod -R $1 $2
    • Adjust permission bits with symbolic mode (u/g/o + r/w/x)

      bash
      chmod $1 $2
  • chown2 rules
    • Recursively set file owner

      bash
      chown -R $1 $2
    • Set file owner

      bash
      chown $1 $2
  • cp2 rules
    • Copy a directory recursively

      bash
      cp -r $1 $2
    • Copy a file

      bash
      cp $1 $2
  • curl4 rules
    • Download a URL to a specific file

      bash
      curl -o $1 $2
    • Download a URL, keeping its remote filename

      bash
      curl -O $1
    • Send a POST request with body

      bash
      curl -X POST -d "$1" $2
    • Fetch a URL

      bash
      curl $1
  • diff2 rules
    • Unified diff between two files

      bash
      diff -u $1 $2
    • Compare two files line-by-line

      bash
      diff $1 $2
  • file1 rule
    • Identify a file type by magic bytes (no native Windows equivalent)

      bash
      file $1
  • find9 rules
    • Find files by name pattern (recursive)

      bash
      find $1 -name "$2"
    • Find only regular files (recursive)

      bash
      find $1 -type f
    • Find only directories (recursive)

      bash
      find $1 -type d
    • Find files by name and delete them

      bash
      find $1 -name "$2" -exec rm {} \;
    • Find files matching a name and search inside them

      bash
      find $1 -name "$2" -exec grep "$3" {} \;
    • Find files modified within the last N days

      bash
      find $1 -mtime -$2
    • Find files larger than N megabytes

      bash
      find $1 -size +$2M
    • Find empty files and directories

      bash
      find $1 -empty
    • Skip a subtree while searching (no clean PowerShell equivalent)

      bash
      find $1 -name "$2" -prune -o -print
  • grep14 rules
    • Recursive case-insensitive search

      bash
      grep -ri "$1" $2
    • Recursive search

      bash
      grep -r "$1" $2
    • Case-insensitive search in a file

      bash
      grep -i "$1" $2
    • Invert match — lines NOT matching pattern

      bash
      grep -v "$1" $2
    • Show line numbers

      bash
      grep -n "$1" $2
    • Search a file for a pattern

      bash
      grep "$1" $2
    • Extended regex search

      bash
      grep -E "$1" $2
    • Fixed-string (literal) search

      bash
      grep -F "$1" $2
    • List filenames containing matches, not the matches themselves

      bash
      grep -l "$1" $2
    • Count matching lines

      bash
      grep -c "$1" $2
    • Show N lines of trailing context after each match

      bash
      grep -A $1 "$2" $3
    • Show N lines of leading context before each match

      bash
      grep -B $1 "$2" $3
    • Show N lines of context around each match

      bash
      grep -C $1 "$2" $3
    • Match only whole words

      bash
      grep -w "$1" $2
  • gzip1 rule
    • Decompress a .gz file in place

      bash
      gunzip $1
  • head3 rules
    • Print the first N lines of a file

      bash
      head -n $1 $2
    • Print the first N lines of a file

      bash
      head -n $1 $2
    • Print the first 10 lines of a file (default head)

      bash
      head $1
  • jobs1 rule
    • List background jobs in the current shell session

      bash
      jobs
  • kill4 rules
    • Forcefully kill a process by PID

      bash
      kill -9 $1
    • Kill a process by PID

      bash
      kill $1
    • Kill all processes by name

      bash
      killall $1
    • Kill processes whose name matches a pattern

      bash
      pkill $1
  • ls8 rules
    • List all files including hidden

      bash
      ls -la
    • List all files including hidden in a directory

      bash
      ls -la $1
    • List files with human-readable sizes

      bash
      ls -lh
    • List files sorted by modification time, newest first

      bash
      ls -lt
    • List only directories

      bash
      ls -d */
    • Long listing (permissions, owner, size)

      bash
      ls -l
    • List a directory

      bash
      ls $1
    • List directory contents

      bash
      ls
  • mkdir2 rules
    • Create a directory tree, ignore if exists

      bash
      mkdir -p $1
    • Create a directory

      bash
      mkdir $1
  • mv1 rule
    • Rename or move a file

      bash
      mv $1 $2
  • patch1 rule
    • Apply a unified diff patch

      bash
      patch -p1 < $1
  • ping1 rule
    • Send ICMP echo requests to a host

      bash
      ping $1
  • ps3 rules
    • List all running processes

      bash
      ps aux
    • List all running processes (System V format)

      bash
      ps -ef
    • Show one process by its PID

      bash
      ps -p $1
  • pwd1 rule
    • Print working directory

      bash
      pwd
  • rm4 rules
    • Recursively delete a directory and contents, no prompts

      bash
      rm -rf $1
    • Recursively delete a directory

      bash
      rm -r $1
    • Delete a file without prompting

      bash
      rm -f $1
    • Delete a file

      bash
      rm $1
  • rsync2 rules
    • Recursively sync with compression and metadata preservation

      bash
      rsync -avz $1 $2
    • Recursively sync, preserving permissions and timestamps

      bash
      rsync -av $1 $2
  • scp2 rules
    • Recursively copy a directory over SSH

      bash
      scp -r $1 $2
    • Copy a file over SSH

      bash
      scp $1 $2
  • sed2 rules
    • In-place find-and-replace in a file

      bash
      sed -i "s/$1/$2/g" $3
    • Stream editor (sed has no single PowerShell equivalent)

      bash
      sed
  • sort7 rules
    • Sort a file and remove duplicates

      bash
      sort $1 | uniq
    • Sort and deduplicate lines in a file

      bash
      sort -u $1
    • Sort in reverse order

      bash
      sort -r $1
    • Sort lines in a file

      bash
      sort $1
    • Numeric sort (treat lines as numbers, not strings)

      bash
      sort -n $1
    • Sort by a specific whitespace-separated column

      bash
      sort -k $1 $2
    • Sort with a custom column delimiter

      bash
      sort -t'$1' -k $2 $3
  • ssh3 rules
    • Connect over SSH on a non-default port

      bash
      ssh -p $1 $2
    • Run a remote command via SSH

      bash
      ssh $1 "$2"
    • Open an interactive SSH session

      bash
      ssh $1
  • stat2 rules
    • Print the size of a file in bytes

      bash
      stat -c %s $1
    • Show file metadata (mode, size, owner, timestamps)

      bash
      stat $1
  • tail4 rules
    • Follow a growing file

      bash
      tail -f $1
    • Print the last N lines of a file

      bash
      tail -n $1 $2
    • Print the last N lines of a file

      bash
      tail -n $1 $2
    • Print the last 10 lines of a file (default tail)

      bash
      tail $1
  • tar2 rules
    • Extract a gzipped tar archive

      bash
      tar -xzf $1
    • Create a gzipped tar archive

      bash
      tar -czf $1 $2
  • tee2 rules
    • Send pipeline output to a file and stdout

      bash
      $1 | tee $2
    • Send pipeline output, appending to a file

      bash
      $1 | tee -a $2
  • top1 rule
    • Interactive process viewer

      bash
      top
  • tr1 rule
    • Delete a set of characters from input

      bash
      $1 | tr -d "$2"
  • uniq1 rule
    • Count occurrences of each unique line

      bash
      sort $1 | uniq -c
  • wc4 rules
    • Count lines in a file

      bash
      wc -l $1
    • Count words in a file

      bash
      wc -w $1
    • Count bytes in a file

      bash
      wc -c $1
    • Count characters in a file

      bash
      wc -m $1
  • wget1 rule
    • Download a file from a URL

      bash
      wget $1
  • xargs3 rules
    • Build and run a command from piped arguments

      bash
      $1 | xargs $2
    • Substitute the piped value into a command via {} placeholder

      bash
      $1 | xargs -I {} $2
    • Pass at most N arguments per invocation

      bash
      $1 | xargs -n $2 $3
  • zip2 rules
    • Extract a zip archive

      bash
      unzip $1
    • Recursively zip a directory

      bash
      zip -r $1 $2

More from shellmap

Total rules in this translator: 204.