Mac (Bash) to Windows (Command Prompt) Mappings

Until late 2018, I’d been a Windows guy most of my life. Then a new project at work required everyone to get Macs, so it was time to learn. This post is basically a “note to self” for command syntax when switching back-n-forth.

Clear the screen #

Mac:

clear 

Windows:

Display all contents of a dir #

Mac:

ls -al 

Windows:

Change dir #

Both:

Rename file #

Mac:

Windows:

Copy file #

Mac:

Windows:

xcopy

Copy dir and subdirs #

Mac:

cp -R

Windows:

xcopy /s

Delete file #

Mac:

Windows:

Delete dir #

Mac:

rm -rf

Windows:

rmdir /s/q

Display file contents #

Mac:

Windows:

type

Print current working dir #

Mac:

Windows:

Change file timestamp #

Mac:

touch

Windows:

type nul >

Display current user #

Mac:

whoami 

Windows:

echo %USERNAME% 

Display all env vars #

Mac:

Windows:

Print PATH #

Mac:

echo $PATH 

Windows:

echo %PATH% 

Print each PATH entry on new line #

Mac:

echo $PATH | tr ':' '\n' 

Windows:

echo %PATH:;=&echo.% 

Show location of a command #

Mac:

which

Windows:

where

Search file for pattern, ignore case #

Mac:

grep -i ""

Windows:

findstr /i ""

Search for file recursively #

Mac:

find . -name ** 

Windows:

dir ** /b/s 

Display networking info #

Mac:

ifconfig 

Windows:

ipconfig /all 

Display aliases #

Mac:

alias 

Windows:

doskey /macros 

Create alias #

Mac:

alias ="" 

Windows:

doskey = $* 

Copy command output to clipboard #

Mac:

 | pbcopy 

Windows:

 | clip 

Display a line of text #

Both:

echo

Display command history #

Mac:

history 

Windows:

doskey /history