Mac to Windows command line mappings

September 22, 2018, last updated November 12, 2018

The Mac command is listed first, followed by the Windows command it maps to.

Clear the screen

clear
cls

Display all contents of a dir

ls -al
dir

Change dir

cd <dir>

Rename file

mv <file> <file>
ren <file> <file>

Copy file

cp <file> <file>
xcopy <file> <file>

Delete file

rm <file>
del <file>

Delete dir

rm -rf <dir>
rmdir /s/q <dir>

Display file contents

cat <file>
type <file>
pwd
cd

Change file timestamp

touch <file>
type nul > <file>

Display current user

whoami
echo %USERNAME%

Display all env vars

env
set
echo $PATH
echo %PATH%

Print each PATH entry on new line

echo $PATH | tr ':' '\n'
echo %PATH:;=&echo.%

Show location of a command

which <command>
where <command>

Search file for pattern, ignore case

grep -i "<pattern>" <file>
findstr /i "<pattern>" <file>

Search for file recursively

find . -name <file>
dir <file> /b/s

Display networking info

ifconfig
ipconfig /all

Display aliases

alias
doskey /macros

Create alias

alias <alias>="<command>"
doskey <alias>=<command> $*

Copy command output to clipboard

<command> | pbcopy
<command> | clip

Display a line of text

echo <text>

Display command history

history
doskey /history