DEVELOPER SANDBOX Academy of Mastery
WelcomeBuild · Explore · Create SD
REFERENCE GUIDE

macOS / Windows Terminal Reference

PowerShell ↔ zsh
Terminal cmds

PowerShell on Windows and zsh on macOS: location, navigation, command discovery, history, and screen control.

WINDOWS
PowerShell-first
PURPOSE
What the command does
macOS
zsh / Terminal
Windows | Purpose | macOS

01 — Orientation & Navigation

Orientation & Navigation

Location & Navigation

Get-Location
Show the current working directory.
pwd
Set-Location path
Change to a directory.
cd path
Set-Location ..
Move up one directory.
cd ..
Set-Location ~
Move to the current user's home directory.
cd ~
Set-Location -
PowerShell: return to the previous location.
cd -
Push-Location path
Save the current location and move elsewhere.
pushd path
Pop-Location
Return to the location saved by push.
popd
Orientation & Navigation

List & Discover

Get-ChildItem
List files and folders.
ls
Get-ChildItem -Force
Include hidden/system items.
ls -la
Get-ChildItem -Directory
List directories only.
find . -maxdepth 1 -type d
Get-ChildItem -File
List files only.
find . -maxdepth 1 -type f
Get-Command node
Find the command PowerShell will run.
command -v node
Get-Command node -All
Show all matching command definitions.
type -a node
Get-Help Get-ChildItem
Open built-in command help.
man ls
Get-Help command -Examples
Show command examples.
man command
Orientation & Navigation

History & Screen

Get-History
Show commands from the current PowerShell session.
history
Clear-History
Clear PowerShell session history.
history -p
Clear-Host
Clear the terminal display.
clear
$PSVersionTable
Show PowerShell version and platform details.
zsh --version
$HOME
Show the user's home-directory path.
echo $HOME
$PWD
Read the current PowerShell path object.
pwd
Orientation & Navigation

Open from Terminal

Invoke-Item .
Open the current directory in the default file manager.
open .
Invoke-Item file.pdf
Open a file with its default application.
open file.pdf
Start-Process https://example.com
Open a URL with the default browser.
open https://example.com
Start-Process code -ArgumentList '.'
Launch an installed application/CLI with arguments.
code .

Create, copy, move, rename, remove, inspect, and compare filesystem objects without leaving the terminal.

WINDOWS
PowerShell-first
PURPOSE
What the command does
macOS
zsh / Terminal
Windows | Purpose | macOS

02 — Files & Directories

Files & Directories

Create

New-Item -ItemType Directory folder
Create a directory.
mkdir folder
New-Item -ItemType Directory a/b -Force
Create a nested directory path.
mkdir -p a/b
New-Item -ItemType File file.txt
Create an empty file.
touch file.txt
Set-Content file.txt 'text'
Create or replace a text file with content.
printf '%s\n' 'text' > file.txt
Add-Content file.txt 'text'
Append text to a file.
printf '%s\n' 'text' >> file.txt
Files & Directories

Copy, Move & Rename

Copy-Item file.txt copy.txt
Copy a file.
cp file.txt copy.txt
Copy-Item folder dest -Recurse
Copy a directory tree.
cp -R folder dest
Move-Item old new
Move a file or folder.
mv old new
Rename-Item old.txt new.txt
Rename an item.
mv old.txt new.txt
Copy-Item *.txt dest
Copy files matching a wildcard.
cp *.txt dest
Files & Directories

Remove Carefully

Remove-Item file.txt
Delete a file.
rm file.txt
Remove-Item folder -Recurse
Delete a directory tree.
rm -r folder
Remove-Item folder -Recurse -Force
Force-remove a directory tree. Verify the path first.
rm -rf folder
Remove-Item *.tmp
Delete files matching a wildcard.
rm *.tmp
Get-ChildItem path
Inspect the target before a destructive command.
ls -la path
Files & Directories

Paths & Names

Split-Path path -Leaf
Return the final file/folder name.
basename path
Split-Path path -Parent
Return the parent-directory path.
dirname path
Resolve-Path path
Resolve a path to its full provider path.
realpath path
Test-Path path
Check whether a path exists.
test -e path
Join-Path parent child
Build a path from components.
printf '%s/%s\n' "$parent" "$child"

Inspect file content, search recursively, count and sort data, use pipelines, and redirect standard streams.

WINDOWS
PowerShell-first
PURPOSE
What the command does
macOS
zsh / Terminal
Windows | Purpose | macOS

03 — Read, Search & Transform Text

Read, Search & Transform Text

Read Files

Get-Content file.txt
Print a text file.
cat file.txt
Get-Content file.txt -Head 20
Show the first 20 lines.
head -n 20 file.txt
Get-Content file.txt -Tail 20
Show the last 20 lines.
tail -n 20 file.txt
Get-Content app.log -Wait
Follow a growing log file.
tail -f app.log
Get-Content file.txt -Raw
Read an entire text file as one string.
cat file.txt
Read, Search & Transform Text

Search Text

Select-String 'text' file.txt
Find matching text and line information.
grep -n 'text' file.txt
Get-ChildItem -Recurse -File | Select-String 'text'
Search text recursively through files.
grep -Rni 'text' .
Select-String 'error' *.log -CaseSensitive
Search matching files with case sensitivity.
grep -n 'error' *.log
Select-String '^TODO' file.txt
Search with a regular expression.
grep -n '^TODO' file.txt
Read, Search & Transform Text

Find Files

Get-ChildItem -Recurse -Filter *.js -File
Find files by name pattern.
find . -name '*.js' -type f
Get-ChildItem -Recurse -Directory
Find directories recursively.
find . -type d
Get-ChildItem -File | Where-Object LastWriteTime -gt (Get-Date).AddDays(-1)
Find files modified within the last day.
find . -type f -mtime -1
Get-ChildItem -Recurse -File | Where-Object Length -gt 10MB
Find files larger than a size threshold.
find . -type f -size +10M
Read, Search & Transform Text

Count, Sort & Group

(Get-Content file.txt).Count
Count lines in a text file.
wc -l file.txt
Get-ChildItem | Measure-Object
Count pipeline objects.
find . -maxdepth 1 | wc -l
Get-Content file.txt | Sort-Object
Sort lines.
sort file.txt
Get-Content file.txt | Sort-Object -Unique
Sort and remove duplicate lines.
sort -u file.txt
Get-Content file.txt | Group-Object
Group equal lines and count occurrences.
sort file.txt | uniq -c
Read, Search & Transform Text

Pipelines & Redirection

Get-Process | Sort-Object CPU
Pipe objects from one command into another.
ps aux | sort
command > file.txt
Overwrite a file with standard output.
command > file.txt
command >> file.txt
Append standard output to a file.
command >> file.txt
command 2> errors.txt
Redirect the error stream.
command 2> errors.txt
command *> all.txt
PowerShell: redirect all streams to one file.
command > all.txt 2>&1
PowerShell 7: a && b
Run the second command only if the first succeeds.
a && b
PowerShell 7: a || b
Run the second command only if the first fails.
a || b
Read, Search & Transform Text

Clipboard

Get-Clipboard
Read clipboard text.
pbpaste
'text' | Set-Clipboard
Copy pipeline text to the clipboard.
printf '%s' 'text' | pbcopy
Get-Content file.txt | Set-Clipboard
Copy file contents to the clipboard.
pbcopy < file.txt

Inspect and stop processes, identify port conflicts, check permissions, inspect system information, and manage disk usage.

WINDOWS
PowerShell-first
PURPOSE
What the command does
macOS
zsh / Terminal
Windows | Purpose | macOS

04 — Processes, Permissions & System

Processes, Permissions & System

Processes

Get-Process
List running processes.
ps aux
Get-Process -Id 1234
Inspect one process by PID.
ps -p 1234
Get-Process node
Find processes by executable/process name.
pgrep -fl node
Stop-Process -Id 1234
Request that a process stop.
kill 1234
Stop-Process -Id 1234 -Force
Force-stop a process; use as a last resort.
kill -9 1234
Start-Process app.exe
Start a process.
open -a 'App Name'
Processes, Permissions & System

Jobs & Background Work

Start-Job { command }
Start a PowerShell background job.
command &
Get-Job
List PowerShell background jobs.
jobs
Receive-Job id
Read output from a PowerShell job.
wait %job
Stop-Job id
Stop a PowerShell background job.
kill %job
Ctrl+C
Interrupt the foreground command.
Ctrl+C
Processes, Permissions & System

Ports

Get-NetTCPConnection -LocalPort 3000
Find TCP connections/listeners using a local port.
lsof -i :3000
Get-NetTCPConnection -State Listen
List listening TCP endpoints.
lsof -nP -iTCP -sTCP:LISTEN
Get-Process -Id PID
Inspect the process after identifying its PID.
ps -p PID
Stop-Process -Id PID
Stop the process causing a local port conflict.
kill PID
Processes, Permissions & System

Permissions & Ownership

Get-Acl path
Inspect access-control information.
ls -le path
icacls path
Display Windows file/folder ACLs.
ls -l path
icacls path /grant USER:F
Grant a Windows user full control; use carefully.
chmod u+rwx path
icacls path /inheritance:e
Enable inherited Windows permissions.
chmod -- reference needed; macOS uses POSIX/ACL inheritance differently
Start-Process PowerShell -Verb RunAs
Open an elevated PowerShell session.
sudo command
—
Change Unix executable permission; Windows executable permissions work differently.
chmod +x script.sh
—
Change Unix file owner; Windows uses ACL ownership tools instead.
sudo chown user file
Processes, Permissions & System

System Information

Get-ComputerInfo
Display broad operating-system and hardware information.
system_profiler SPSoftwareDataType SPHardwareDataType
systeminfo
Show Windows OS, memory, boot, and system details.
sw_vers
$env:PROCESSOR_ARCHITECTURE
Show the process architecture.
uname -m
Get-Date
Show the current local date and time.
date
Get-TimeZone
Show the configured time zone.
systemsetup -gettimezone
hostname
Show the machine hostname.
hostname
whoami
Show the current user identity.
whoami
Processes, Permissions & System

Disk & Storage

Get-PSDrive -PSProvider FileSystem
Show filesystem drives and free/used space.
df -h
Get-Volume
Show Windows volume information.
diskutil list
Get-ChildItem folder -Recurse -File | Measure-Object Length -Sum
Calculate total file bytes under a folder.
du -sh folder
Get-ChildItem folder | Sort-Object Length -Descending
Find larger items in a directory.
du -sh folder/* | sort -h

Work with environment variables, PATH, shell profiles, aliases, package managers, and terminal configuration.

WINDOWS
PowerShell-first
PURPOSE
What the command does
macOS
zsh / Terminal
Windows | Purpose | macOS

05 — Environment, Shell & Packages

Environment, Shell & Packages

Environment Variables

$env:NAME
Read one environment variable.
printenv NAME
$env:NAME = 'value'
Set an environment variable for the current shell session.
export NAME=value
Remove-Item Env:NAME
Remove a session environment variable.
unset NAME
Get-ChildItem Env:
List environment variables.
printenv | sort
$env:PATH
Show the executable search path.
echo $PATH
$env:PATH -split ';'
Display Windows PATH entries individually.
printf '%s\n' ${PATH//:/ }
Environment, Shell & Packages

Profiles & Shell Configuration

$PROFILE
Show the current PowerShell profile path.
echo ~/.zshrc
Test-Path $PROFILE
Check whether the PowerShell profile exists.
test -f ~/.zshrc
notepad $PROFILE
Edit the PowerShell profile with Notepad.
nano ~/.zshrc
. $PROFILE
Reload the PowerShell profile in the current session.
source ~/.zshrc
pwsh
Start PowerShell 7 if installed.
exec zsh
Environment, Shell & Packages

Aliases & Functions

Get-Alias
List PowerShell aliases.
alias
Get-Alias ls
See which command an alias resolves to.
type ls
Set-Alias ll Get-ChildItem
Create a session alias.
alias ll='ls -lah'
Remove-Item Alias:ll
Remove a session alias.
unalias ll
function Name { ... }
Define a reusable shell function.
Name() { ...; }
Environment, Shell & Packages

Windows Package Manager / Homebrew

winget search package
Search the OS package manager.
brew search package
winget install ID
Install a package.
brew install package
winget list
List installed packages known to the package manager.
brew list
winget upgrade
Show packages with upgrades available.
brew outdated
winget upgrade --all
Upgrade supported installed packages.
brew upgrade
winget uninstall ID
Remove a package.
brew uninstall package
winget source update
Refresh package-source metadata.
brew update
Environment, Shell & Packages

Command Resolution

Get-Command name
Show which executable/function/alias will run.
command -v name
Get-Command name -All
Show all command matches PowerShell can resolve.
type -a name
where.exe name
Search Windows PATH for matching executable files.
which -a name
Get-Command name | Format-List *
Inspect command type, source, path, and metadata.
type name

Diagnose networking, test HTTP and ports, use SSH, compress files, and apply a fast terminal troubleshooting loop.

WINDOWS
PowerShell-first
PURPOSE
What the command does
macOS
zsh / Terminal
Windows | Purpose | macOS

06 — Network, Remote, Archives & Recovery

Network, Remote, Archives & Recovery

Network Identity & DNS

ipconfig
Show Windows IP configuration.
ifconfig
Get-NetIPAddress
List Windows IP addresses and interfaces.
ipconfig getifaddr en0
Test-Connection host
Send ICMP echo requests.
ping host
Resolve-DnsName example.com
Resolve DNS records.
dig example.com
nslookup example.com
Run a traditional DNS lookup.
nslookup example.com
Get-NetRoute
Inspect the Windows routing table.
netstat -rn
Network, Remote, Archives & Recovery

Ports & Connectivity

Test-NetConnection host -Port 443
Test whether a TCP port is reachable.
nc -vz host 443
Get-NetTCPConnection -LocalPort 5173
Find the process endpoint using a development port.
lsof -i :5173
Test-NetConnection host -TraceRoute
Trace the network path where supported.
traceroute host
Get-NetAdapter
List Windows network adapters.
networksetup -listallhardwareports
Network, Remote, Archives & Recovery

HTTP

curl.exe URL
Send a basic HTTP GET request using curl.
curl URL
curl.exe -I URL
Request response headers only.
curl -I URL
curl.exe -L URL
Follow HTTP redirects.
curl -L URL
curl.exe -o file URL
Download response content to a file.
curl -o file URL
Invoke-WebRequest URL
PowerShell-native web request with structured response information.
curl -i URL
Invoke-RestMethod URL
PowerShell-native request that parses common structured API responses.
curl URL
Network, Remote, Archives & Recovery

SSH & Secure Copy

ssh user@host
Open an SSH session when OpenSSH is installed.
ssh user@host
ssh-keygen -t ed25519
Create an Ed25519 SSH key pair.
ssh-keygen -t ed25519
ssh-add path\to\key
Add a private key to the SSH authentication agent.
ssh-add ~/.ssh/id_ed25519
scp file user@host:/path
Copy a file over SSH.
scp file user@host:/path
scp -r folder user@host:/path
Copy a directory recursively over SSH.
scp -r folder user@host:/path
ssh -T git@github.com
Test SSH authentication to GitHub.
ssh -T git@github.com
Network, Remote, Archives & Recovery

Archives

Compress-Archive -Path folder -DestinationPath archive.zip
Create a ZIP archive.
zip -r archive.zip folder
Expand-Archive archive.zip -DestinationPath folder
Extract a ZIP archive.
unzip archive.zip -d folder
tar -czf archive.tar.gz folder
Create a gzip-compressed tar archive with modern Windows tar.
tar -czf archive.tar.gz folder
tar -xzf archive.tar.gz
Extract a gzip-compressed tar archive.
tar -xzf archive.tar.gz
tar -tf archive.tar.gz
List archive contents without extracting.
tar -tf archive.tar.gz
Network, Remote, Archives & Recovery

Fast Troubleshooting Loop

Get-Location; Get-ChildItem -Force
Confirm the current project/location and visible files.
pwd && ls -la
Get-Command tool
Confirm a required command is installed and resolvable.
command -v tool
$PSVersionTable
Confirm shell/runtime environment when shell behavior is unexpected.
echo $SHELL; zsh --version
Get-ChildItem Env:
Inspect environment configuration.
printenv | sort
Get-NetTCPConnection -LocalPort PORT
Check for a local port conflict.
lsof -i :PORT
Test-NetConnection localhost -Port PORT
Test whether a local TCP service is reachable.
nc -vz localhost PORT
curl.exe -I http://localhost:PORT
Confirm that a local HTTP server responds.
curl -I http://localhost:PORT
Network, Remote, Archives & Recovery

High-Risk Commands

Remove-Item path -Recurse -Force
Can permanently delete a directory tree. Verify the exact path.
rm -rf path
Stop-Process -Id PID -Force
Force termination can lose unsaved state; use only when normal stop fails.
kill -9 PID
icacls path /grant ...
Permission changes can expose or lock out files; inspect ACLs first.
chmod / chown
winget upgrade --all
Bulk upgrades can change many installed tools; review before running.
brew upgrade
Elevated PowerShell
Administrator/root commands can alter the whole system.
sudo command
Network, Remote, Archives & Recovery

Keyboard Recall

Ctrl+C
Interrupt the foreground command.
Ctrl+C
Tab
Complete commands and paths.
Tab
Up / Down
Move through command history.
Up / Down
Ctrl+L
Clear/redraw the screen in shells that support it.
Ctrl+L
Ctrl+R
Reverse-search history when PSReadLine/shell bindings support it.
Ctrl+R