Commands

Commands that
copy clean.

211 hand-checked commands for your Mac, PC, servers and projects. Fill in the orange blanks, hit copy, paste. No curly quotes or broken dashes. Ever.

211 commands11 categories8 guides
Fill the orange blanks, then copy!

Step-by-step guides

Short tutorials with replayable terminals for the problems people hit most.

211 commands

Git

Branch, commit, undo and rescue your work.

37 commands ›

Undo the last commit, keep the changes

macOSWindowsLinux

Removes the last commit but leaves its changes staged, ready to edit and commit again.

git reset --soft HEAD~1

If the commit was already pushed, use git revert instead so you don’t rewrite shared history.

Safely undo a pushed commit

macOSWindowsLinux

Creates a new commit that reverses an earlier one. Safe on shared branches because history isn’t rewritten.

git revert

Fix the last commit message

macOSWindowsLinuxCareful

Replaces the message of the most recent commit.

git commit --amend -m ""

Rewrites the commit. If it was already pushed you’ll need git push --force-with-lease.

Add a forgotten file to the last commit

macOSWindowsLinuxCareful

Stages the file and folds it into the previous commit without changing its message.

git add && git commit --amend --no-edit

Rewrites the last commit; avoid on commits others have pulled.

Short status with branch info

macOSWindowsLinux

A compact view of changed files plus how far ahead or behind your branch is.

git status -sb

Stage everything and commit

macOSWindowsLinux

Stages new, changed and deleted files, then commits them in one go.

git add -A && git commit -m ""

Create and switch to a new branch

macOSWindowsLinux

Creates a branch from where you are and moves onto it.

git switch -c

Switch branches

macOSWindowsLinux

Moves to an existing branch.

git switch

Push a new branch and track it

macOSWindowsLinux

Publishes the current branch with the same name and sets it as the upstream, so plain git push works next time.

git push -u origin HEAD

Pull without a merge commit

macOSWindowsLinux

Fetches remote changes and replays your local commits on top, keeping history linear.

git pull --rebase

Discard changes to a file

macOSWindowsLinuxCareful

Throws away uncommitted edits to a file and restores the last committed version.

git restore

Uncommitted edits to that file are lost.

Unstage a file

macOSWindowsLinux

Removes a file from the staging area but keeps your edits.

git restore --staged

Make local branch match the remote exactly

macOSWindowsLinuxDestructive

Throws away all local commits and changes on this branch and copies the remote version.

git fetch origin && git reset --hard origin/

Deletes uncommitted work and unpushed commits. Run git stash first if you might need them.

Stash work in progress

macOSWindowsLinux

Shelves your uncommitted changes so you can switch branches with a clean tree.

git stash push -m ""

Bring back stashed work

macOSWindowsLinux

Re-applies the most recent stash and removes it from the stash list.

git stash pop

List stashes

macOSWindowsLinux

Shows every stash with its message.

git stash list

Pretty one-line history graph

macOSWindowsLinux

A compact visual graph of all branches and commits.

git log --oneline --graph --decorate --all

See what you’re about to commit

macOSWindowsLinux

Shows the exact changes that are staged.

git diff --staged

See who changed each line

macOSWindowsLinux

Annotates every line with the commit and author that last changed it.

git blame

Copy one commit onto this branch

macOSWindowsLinux

Applies the changes from a single commit on another branch to your current branch.

git cherry-pick

Recover "lost" commits

macOSWindowsLinux

Shows everywhere HEAD has been, including commits removed by reset or rebase. Use the hash with git reset or git switch -c to get them back.

git reflog

Preview deleting untracked files

macOSWindowsLinux

Lists the untracked files and folders that git clean -fd would delete. Nothing is removed.

git clean -nd

Delete untracked files and folders

macOSWindowsLinuxDestructive

Removes every untracked file and directory from the working tree.

git clean -fd

Permanently deletes untracked files (they’re not in Git, so there’s no undo). Run git clean -nd first to preview.

Delete a local branch

macOSWindowsLinux

Deletes a branch that has been merged. Use -D to force-delete an unmerged one.

git branch -d

Delete a remote branch

macOSWindowsLinuxCareful

Removes the branch from the remote repository.

git push origin --delete

Rename the current branch

macOSWindowsLinux

Renames the branch you’re on.

git branch -m

Delete all merged local branches

macOSLinuxCareful

Cleans up local branches that are already merged into the base branch.

git branch --merged | grep -v '^[ *]*$' | xargs git branch -d

Force-push safely

macOSWindowsLinuxCareful

Overwrites the remote branch only if nobody else has pushed since you last fetched.

git push --force-with-lease

Still rewrites remote history; only use on branches you own.

Squash the last few commits into one

macOSWindowsLinuxCareful

Combines your last N commits into a single commit.

git reset --soft HEAD~ && git commit -m ""

Rewrites history; avoid on commits that are already shared.

Tag and push a release

macOSWindowsLinux

Creates an annotated version tag and publishes it.

git tag -a v -m "Release v" && git push origin v

Set your name and email

macOSWindowsLinux

Sets the author identity used on every commit on this computer.

git config --global user.name "" && git config --global user.email ""

Use "main" for new repositories

macOSWindowsLinux

Makes git init create a main branch instead of master.

git config --global init.defaultBranch main

Change the remote URL

macOSWindowsLinux

Points origin at a new address, for example when switching from HTTPS to SSH.

git remote set-url origin

Clone just the latest snapshot

macOSWindowsLinux

Downloads only the most recent commit. Much faster for big repositories.

git clone --depth 1

Commits per author

macOSWindowsLinux

Ranks contributors by number of commits.

git shortlog -sn --all

Stop tracking a file but keep it

macOSWindowsLinux

Removes the file from Git (for example after adding it to .gitignore) without deleting it from disk.

git rm --cached

macOS

Hidden settings, Finder and Dock tweaks, system info.

32 commands ›

Show hidden files in Finder

macOS

Reveals dotfiles and hidden folders everywhere in Finder. Tip: ⌘⇧. toggles this temporarily in any Finder window.

defaults write com.apple.finder AppleShowAllFiles -bool true && killall Finder

Hide hidden files again

macOS

Restores Finder’s default of hiding dotfiles.

defaults write com.apple.finder AppleShowAllFiles -bool false && killall Finder

Always show file extensions

macOS

Shows .pdf, .png, .app and every other extension in Finder.

defaults write NSGlobalDomain AppleShowAllExtensions -bool true && killall Finder

Show the path bar in Finder

macOS

Adds the folder path to the bottom of every Finder window.

defaults write com.apple.finder ShowPathbar -bool true && killall Finder

Unhide your Library folder

macOS

Makes ~/Library visible in Finder permanently.

chflags nohidden ~/Library

Auto-hide the Dock instantly

macOS

Hides the Dock and removes the delay before it slides back in.

defaults write com.apple.dock autohide -bool true && defaults write com.apple.dock autohide-delay -float 0 && defaults write com.apple.dock autohide-time-modifier -float 0.4 && killall Dock

Restore the default Dock animation

macOS

Undoes the instant auto-hide tweak.

defaults delete com.apple.dock autohide-delay && defaults delete com.apple.dock autohide-time-modifier && killall Dock

Add a spacer to the Dock

macOS

Adds an empty gap you can drag between apps to group them.

defaults write com.apple.dock persistent-apps -array-add '{"tile-type"="spacer-tile";}' && killall Dock

Reset the Dock to factory layout

macOSCareful

Restores the original Dock apps and settings.

defaults delete com.apple.dock && killall Dock

Your custom Dock layout is lost.

Save screenshots to a folder

macOS

Stops screenshots cluttering your Desktop.

mkdir -p ~/ && defaults write com.apple.screencapture location ~/ && killall SystemUIServer

Change screenshot format

macOS

Use jpg, png, heic, pdf or tiff. Smaller JPGs are handy for sharing.

defaults write com.apple.screencapture type -string ""

Remove the shadow from window screenshots

macOS

Window captures (⌘⇧4 then Space) no longer include the drop shadow.

defaults write com.apple.screencapture disable-shadow -bool true

Keep your Mac awake

macOS

Prevents the display sleeping for the given number of seconds. Leave off -t to stay awake until you press Ctrl+C.

caffeinate -d -t

Flush the DNS cache

macOSAdmin

Fixes websites that won’t load after a DNS change.

sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder

Battery charge and health

macOS

Shows the battery’s cycle count, condition and maximum capacity.

system_profiler SPPowerDataType | grep -E "Cycle Count|Condition|Maximum Capacity"

Hardware overview

macOS

Model, chip, memory and serial number.

system_profiler SPHardwareDataType

macOS version

macOS

Prints the product name, version and build.

sw_vers

Your local IP address

macOS

The Mac’s address on your Wi-Fi network (use en1 if en0 is empty).

ipconfig getifaddr en0

Strip formatting from the clipboard

macOS

Re-copies the clipboard as plain text, dropping fonts and colours. (ClepBoard also removes hidden characters.)

pbpaste | pbcopy

Copy a file’s contents to the clipboard

macOS

Puts the whole file on the clipboard without opening it.

pbcopy <

Open the current folder in Finder

macOS

Opens a Finder window for the folder your Terminal is in.

open .

Make your Mac talk

macOS

Speaks the text aloud. Chain it after long commands: npm run build; say done.

say ""

Toggle Dark Mode

macOS

Switches between Light and Dark appearance.

osascript -e 'tell application "System Events" to tell appearance preferences to set dark mode to not dark mode'

Faster key repeat

macOS

Makes held keys repeat faster than System Settings allows. Log out and back in to apply.

defaults write NSGlobalDomain KeyRepeat -int 2 && defaults write NSGlobalDomain InitialKeyRepeat -int 15

Hold a key to repeat (no accent menu)

macOS

Holding a letter repeats it instead of showing accent options. Restart apps to apply.

defaults write -g ApplePressAndHoldEnabled -bool false

Stop .DS_Store files on network drives

macOS

Finder won’t litter shared and network folders with .DS_Store files.

defaults write com.apple.desktopservices DSDontWriteNetworkStores -bool true

Open an app macOS says is "damaged"

macOSCareful

Removes the download quarantine flag from an app you trust.

xattr -dr com.apple.quarantine ""

Bypasses a Gatekeeper safety check. Only do this for apps from sources you trust.

Rebuild the Spotlight index

macOSAdmin

Fixes Spotlight not finding files. Re-indexing takes a while in the background.

sudo mdutil -E /

Fix sound that stopped working

macOSAdmin

Restarts the audio service; it relaunches automatically.

sudo killall coreaudiod

Free up inactive memory

macOSAdmin

Flushes disk caches from memory.

sudo purge

Sleep the display (lock)

macOS

Turns off the display immediately; locks if a password is required after sleep.

pmset displaysleepnow

Install developer command line tools

macOS

Installs git, make, clang and other tools developers need, without the full Xcode app.

xcode-select --install

Windows

Repairs, networking, winget and power tricks.

28 commands ›

Flush the DNS cache

WindowsPowerShell/CMD

Fixes websites that won’t load after a DNS change.

ipconfig /flushdns

Full network configuration

WindowsPowerShell/CMD

IP addresses, DNS servers, MAC addresses and more for every adapter.

ipconfig /all

Repair system files

WindowsPowerShell/CMDAdmin

Scans protected Windows files and repairs corrupted ones.

sfc /scannow

Repair the Windows image

WindowsPowerShell/CMDAdmin

Fixes the component store that sfc relies on. Run it if sfc can’t repair something, then run sfc again.

DISM /Online /Cleanup-Image /RestoreHealth

Check and fix disk errors

WindowsPowerShell/CMDAdminCareful

Finds and repairs file system errors and bad sectors on drive C.

chkdsk C: /f /r

Runs at the next restart and can take hours on large drives.

Reset the network stack

WindowsPowerShell/CMDAdminCareful

Fixes many "connected but no internet" problems.

netsh winsock reset

Restart afterwards. Some VPN software may need reinstalling.

Show a saved Wi-Fi password

WindowsPowerShell/CMD

The password appears next to "Key Content". Use netsh wlan show profiles to list network names.

netsh wlan show profile name="" key=clear

Battery health report

WindowsPowerShell/CMD

Saves an HTML report with design vs. current capacity and usage history.

powercfg /batteryreport

Find what is using a port

WindowsPowerShell/CMD

The last column is the process ID (PID).

netstat -ano | findstr :

Kill a process by PID

WindowsPowerShell/CMDCareful

Force-closes the process.

taskkill /PID /F

Unsaved work in that program is lost.

Kill a program by name

WindowsPowerShell/CMDCareful

Force-closes every running copy of the program.

taskkill /IM /F

Update all apps

WindowsPowerShell

Updates every app winget knows about. Run winget upgrade first to see the list.

winget upgrade --all

Install an app

WindowsPowerShell

Installs an app by ID. Find IDs with winget search.

winget install

List installed apps

WindowsPowerShell

Every installed app with its version.

winget list

Restart into BIOS/UEFI

WindowsPowerShell/CMDAdminCareful

Reboots straight into firmware settings.

shutdown /r /fw /t 0

Restarts immediately. Save your work first.

Shut down after a delay

WindowsPowerShell/CMD

Schedules a shutdown. Cancel it with shutdown /a.

shutdown /s /t

Verify a download’s checksum

WindowsPowerShell

Compare the hash with the one published by the download site.

Get-FileHash "" -Algorithm SHA256

Show PATH one entry per line

WindowsPowerShell

Makes the PATH environment variable readable.

$env:Path -split ';'

Clear temporary files

WindowsPowerShellCareful

Deletes files in your user temp folder. Files in use are skipped.

Remove-Item "$env:TEMP\*" -Recurse -Force -ErrorAction SilentlyContinue

Install WSL (Linux on Windows)

WindowsPowerShellAdmin

Installs the Windows Subsystem for Linux with Ubuntu. Restart when prompted.

wsl --install

Copy a file’s contents to the clipboard

WindowsPowerShell

Puts a text file on the clipboard.

Get-Content | Set-Clipboard

Test if a host and port are reachable

WindowsPowerShell

Shows whether a TCP connection succeeds. Handy for firewall debugging.

Test-NetConnection -Port

How long since the last restart

WindowsPowerShell

Shows uptime in days, hours and minutes.

(Get-Date) - (Get-CimInstance Win32_OperatingSystem).LastBootUpTime

Get the serial number

WindowsPowerShell

Useful for warranty lookups.

Get-CimInstance Win32_BIOS | Select-Object SerialNumber

Classic right-click menu (Windows 11)

WindowsPowerShellCareful

Brings back the full context menu without "Show more options". Delete that key to undo.

reg add "HKCU\Software\Classes\CLSID\{86ca1aa0-34aa-4e8b-a509-50c905bae2a2}\InprocServer32" /f /ve; Stop-Process -Name explorer -Force

Edits the registry and restarts Explorer.

Show hidden files in Explorer

WindowsPowerShellCareful

Turns on hidden files and restarts Explorer.

Set-ItemProperty -Path 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced' -Name Hidden -Value 1; Stop-Process -Name explorer -Force

Edit the hosts file

WindowsPowerShell/CMDAdmin

Open from an administrator terminal so you can save changes.

notepad C:\Windows\System32\drivers\etc\hosts

System information

WindowsPowerShell/CMD

OS version, install date, memory, hotfixes and more.

systeminfo

Linux

Packages, services, processes and permissions.

25 commands ›

Update everything (Ubuntu/Debian)

LinuxAdmin

Refreshes package lists and installs all available updates.

sudo apt update && sudo apt upgrade -y

Update everything (Fedora)

LinuxAdmin

Refreshes metadata and upgrades all packages.

sudo dnf upgrade --refresh

Update everything (Arch)

LinuxAdmin

Syncs the package database and upgrades the system.

sudo pacman -Syu

Remove unused packages

LinuxAdmin

Deletes packages nothing depends on and clears the download cache.

sudo apt autoremove -y && sudo apt clean

Free disk space

LinuxmacOS

Disk usage of every mounted drive in human-readable sizes.

df -h

Biggest folders here

LinuxmacOS

Size of each item in the current folder, smallest to largest.

du -sh * | sort -h

Memory usage

Linux

Used, free and available RAM and swap.

free -h

Top memory-hungry processes

Linux

The ten processes using the most memory.

ps aux --sort=-%mem | head -n 10

Stop a process by PID

LinuxmacOSCareful

Asks the process to exit. If it ignores you, use kill -9 to force it.

kill

Stop processes by name

LinuxmacOSCareful

Stops every process whose command line matches.

pkill -f

Matches broadly; check with pgrep -fl first.

Check a service

Linux

Shows whether a service is running and its latest log lines.

systemctl status

Restart a service

LinuxAdmin

Stops and starts the service.

sudo systemctl restart

Start a service now and on boot

LinuxAdmin

Enables the service at boot and starts it immediately.

sudo systemctl enable --now

Follow a service’s logs

Linux

Streams new log lines as they arrive. Ctrl+C to stop.

journalctl -u -f

Which distro and version

Linux

Name, version and ID of the Linux distribution.

cat /etc/os-release

Kernel version

LinuxmacOS

Kernel name, version and architecture.

uname -a

Make a script executable

LinuxmacOS

Lets you run it with ./script.sh.

chmod +x

Take ownership of a folder

LinuxAdminCareful

Fixes "permission denied" on files created by root.

sudo chown -R $USER:$USER

Give a user sudo rights

LinuxAdminCareful

Adds the user to the sudo group (wheel on Fedora/Arch). They need to log in again.

sudo usermod -aG sudo

Listening ports and their programs

LinuxAdmin

Every open TCP/UDP port with the process that owns it.

sudo ss -tulpn

Open a port in the firewall

LinuxAdminCareful

Allows incoming traffic on a port (Ubuntu’s ufw). Enable the firewall with sudo ufw enable.

sudo ufw allow /tcp

Always allow SSH (22) before enabling ufw on a remote server, or you’ll lock yourself out.

Edit scheduled jobs

LinuxmacOS

Opens your cron table. Each line is: minute hour day month weekday command.

crontab -e

Re-run a command every few seconds

Linux

Refreshes the output on screen. Ctrl+C to stop.

watch -n

Copy a file to the clipboard

Linux

For Wayland desktops. On X11 use: xclip -selection clipboard < file.

wl-copy <

CPU details

Linux

Model, cores, threads and cache sizes.

lscpu

Network

Ports in use, DNS, IPs, HTTP and certificates.

15 commands ›

What is using this port?

macOSLinux

Shows the program and PID listening on or connected to the port.

lsof -i :

Free a port (kill whatever is on it)

macOSLinuxCareful

Force-stops every process using the port. Fixes "address already in use".

kill -9 $(lsof -ti :)

Force-kills without letting the program save. Check with lsof -i first.

Free a port on Windows

WindowsPowerShellCareful

Finds the process listening on the port and stops it.

Stop-Process -Id (Get-NetTCPConnection -LocalPort ).OwningProcess -Force

All listening ports (macOS)

macOSAdmin

Every program accepting connections, with numeric addresses and ports.

sudo lsof -iTCP -sTCP:LISTEN -n -P

Your public IP address

macOSWindowsLinux

The IP the internet sees you as.

curl -s https://ifconfig.me

Look up a domain’s IP (DNS)

macOSLinux

Prints the addresses a domain resolves to. Add a record type like MX or TXT after the domain.

dig +short

DNS lookup on Windows

WindowsPowerShell/CMD

Shows the DNS server used and the addresses for a domain.

nslookup

Ping a host

macOSLinux

Sends four pings and reports latency and packet loss. (On Windows, just ping host.)

ping -c 4

Trace the route to a host

macOSLinux

Lists every hop between you and the destination. On Windows use tracert.

traceroute

See a site’s HTTP headers

macOSWindowsLinux

Fetches only the response headers: status code, caching, redirects, server.

curl -I

Download a file

macOSWindowsLinux

Saves the file with its original name, following redirects.

curl -LO

How long does a request take?

macOSLinux

Prints the total time for one request.

curl -o /dev/null -s -w "%{time_total}s\n"

When does a site’s SSL certificate expire?

macOSLinux

Shows the certificate’s valid-from and valid-until dates.

echo | openssl s_client -connect :443 -servername 2>/dev/null | openssl x509 -noout -dates

Share a folder over HTTP

macOSWindowsLinux

Serves the current folder at http://localhost:8000. Great for testing static sites.

python3 -m http.server

Who owns a domain

macOSLinux

Registrar, creation and expiry dates and name servers.

whois

Files

Find, search, archive, sync and checksum.

17 commands ›

Find files by name

macOSLinux

Searches the folder and all subfolders for matching names.

find -name ""

Find large files

macOSLinux

Lists files bigger than the size you choose, with their sizes.

find -type f -size + -exec ls -lh {} \; 2>/dev/null

Search text inside files

macOSLinux

Every line containing the text, with file names and line numbers.

grep -rn ""

Fast search with ripgrep

macOSWindowsLinux

Much faster than grep and skips .gitignore’d files. Install with brew install ripgrep.

rg ""

Compress a folder (.tar.gz)

macOSLinux

Creates a compressed archive.

tar -czvf

Extract a .tar.gz

macOSLinux

Unpacks the archive into the current folder.

tar -xzvf

Zip a folder

macOSLinux

Creates a .zip that opens anywhere.

zip -r

Unzip into a folder

macOSLinux

Extracts the zip into the given folder.

unzip -d

Sync two folders

macOSLinux

Copies only what changed and preserves timestamps and permissions. The trailing slash on the source means "its contents".

rsync -avh --progress

Follow a log file live

macOSLinux

Prints new lines as they’re written. Ctrl+C to stop.

tail -f

Count lines in a file

macOSLinux

Number of lines (add -w for words).

wc -l

Checksum a file

macOSLinux

Verify downloads against the published hash. On Linux you can also use sha256sum.

shasum -a 256

Show a folder tree

macOSLinux

Visual folder structure, limited to N levels. Install with brew install tree.

tree -L

Change the extension of many files

macOSLinuxCareful

Renames every .txt in the folder to .md.

for f in *.; do mv -- "$f" "${f%.}."; done

Renames files in place. Try it on a copy first.

Delete all .DS_Store files

macOSLinuxCareful

Removes macOS folder metadata files from the current folder down.

find . -name ".DS_Store" -type f -delete

Delete every node_modules folder

macOSLinuxDestructive

Frees up gigabytes from old projects. Reinstall later with npm install.

find . -name "node_modules" -type d -prune -exec rm -rf {} +

Deletes folders permanently. Run it from your projects folder, not from / or ~.

Docker

Containers, images, Compose and cleanup.

15 commands ›

List all containers

macOSWindowsLinux

Running and stopped containers with their status and ports.

docker ps -a

Run a container on a port

macOSWindowsLinux

Starts a container in the background and maps a port to your machine.

docker run -d -p : --name

Throwaway interactive container

macOSWindowsLinux

Opens a shell in a fresh container that is deleted when you exit.

docker run -it --rm bash

Open a shell inside a container

macOSWindowsLinux

Use bash instead of sh if the image has it.

docker exec -it sh

Follow a container’s logs

macOSWindowsLinux

Last 100 lines, then streams new ones.

docker logs -f --tail 100

Build an image

macOSWindowsLinux

Builds from the Dockerfile in the current folder.

docker build -t .

Copy a file out of a container

macOSWindowsLinux

Works the other way round too.

docker cp :

Start a Compose project

macOSWindowsLinux

Builds images if needed and starts all services in the background.

docker compose up -d --build

Follow Compose logs

macOSWindowsLinux

Leave out the service name to see all of them.

docker compose logs -f

Stop a Compose project

macOSWindowsLinux

Stops and removes the containers and network. Add -v to also delete volumes (data).

docker compose down

Stop all running containers

macOSLinuxCareful

Gracefully stops every running container.

docker stop $(docker ps -q)

How much space Docker uses

macOSWindowsLinux

Space used by images, containers, volumes and build cache.

docker system df

Remove dangling images

macOSWindowsLinux

Deletes untagged leftover layers from old builds. Asks before deleting.

docker image prune

Remove stopped containers

macOSWindowsLinuxCareful

Deletes all stopped containers. Asks before deleting.

docker container prune

Reclaim all unused Docker space

macOSWindowsLinuxDestructive

Removes stopped containers, unused networks, every image not used by a container, and the build cache.

docker system prune -a

You’ll need to re-download or rebuild images. Volumes are kept unless you add --volumes.

Node & npm

Install, update, debug and scaffold projects.

14 commands ›

Node and npm versions

macOSWindowsLinux

Check which versions you’re running.

node -v && npm -v

Fresh reinstall of dependencies

macOSLinuxCareful

The classic fix for weird dependency errors.

rm -rf node_modules package-lock.json && npm install

Regenerates the lockfile, so versions may change within your semver ranges.

Clean install from the lockfile

macOSWindowsLinux

Deletes node_modules and installs exactly what package-lock.json says. Best for CI and reproducible builds.

npm ci

See outdated packages

macOSWindowsLinux

Current, wanted and latest versions of every dependency.

npm outdated

Update all packages to latest

macOSWindowsLinuxCareful

Bumps every version in package.json to the newest release.

npx npm-check-updates -u && npm install

Includes major versions that may have breaking changes. Commit first.

Why is this package installed?

macOSWindowsLinux

Shows which dependencies pulled it in.

npm explain

List global packages

macOSWindowsLinux

Everything installed with npm install -g.

npm ls -g --depth=0

Clear the npm cache

macOSWindowsLinux

Fixes some corrupted-download errors.

npm cache clean --force

Fix vulnerable dependencies

macOSWindowsLinux

Upgrades packages with known vulnerabilities where it’s safe to do so.

npm audit fix

Install and use the latest LTS Node

macOSWindowsLinux

Requires nvm (or nvm-windows).

nvm install --lts && nvm use --lts

Create a Next.js app

macOSWindowsLinux

Scaffolds a new Next.js project with prompts for TypeScript, ESLint and more.

npx create-next-app@latest

Create a Vite app

macOSWindowsLinux

Choose React, Vue, Svelte and more.

npm create vite@latest

Enable pnpm

macOSWindowsLinux

Turns on pnpm using Node’s built-in Corepack.

corepack enable pnpm

Run a package.json script

macOSWindowsLinux

Run npm run with no name to list available scripts.

npm run

Python

Virtual environments, packages and uv.

11 commands ›

Create and activate a virtual environment

macOSLinux

Keeps this project’s packages separate from the system.

python3 -m venv .venv && source .venv/bin/activate

Create and activate a venv on Windows

WindowsPowerShell

If activation is blocked, run: Set-ExecutionPolicy -Scope CurrentUser RemoteSigned

python -m venv .venv; .venv\Scripts\Activate.ps1

Install from requirements.txt

macOSWindowsLinux

Installs every package listed.

pip install -r requirements.txt

Save installed packages

macOSWindowsLinux

Writes exact versions of everything in the environment.

pip freeze > requirements.txt

Upgrade pip

macOSWindowsLinux

Use python instead of python3 on Windows.

python3 -m pip install --upgrade pip

Install uv

macOSLinuxCareful

uv is a very fast Python package and project manager.

curl -LsSf https://astral.sh/uv/install.sh | sh

Pipes a script from the internet into your shell. This is the official installer; read it first if unsure.

Start a project with uv

macOSWindowsLinux

Creates pyproject.toml, a starter main.py and a .gitignore.

uv init && cd

Add a package with uv

macOSWindowsLinux

Installs it into the project environment and records it in pyproject.toml.

uv add

Run a script with uv

macOSWindowsLinux

Runs inside the project environment, syncing dependencies first.

uv run

Pretty-print JSON

macOSWindowsLinux

Formats a JSON file with indentation. Also works on piped input.

python3 -m json.tool

Which Python am I using?

macOSLinux

Path and version of the active interpreter.

which python3 && python3 --version

SSH

Keys, servers, tunnels and file transfer.

9 commands ›

Generate an SSH key

macOSWindowsLinux

Creates a modern, secure key pair in ~/.ssh. Press Enter to accept the default location.

ssh-keygen -t ed25519 -C ""

Copy your public key (macOS)

macOS

Puts the public key on the clipboard to paste into GitHub, GitLab or a server.

pbcopy < ~/.ssh/id_ed25519.pub

Copy your public key (Windows)

WindowsPowerShell

Puts the public key on the clipboard.

Get-Content $env:USERPROFILE\.ssh\id_ed25519.pub | Set-Clipboard

Remember the key passphrase (macOS)

macOS

Stores the passphrase in Keychain so you’re not asked every time.

ssh-add --apple-use-keychain ~/.ssh/id_ed25519

Test your GitHub SSH connection

macOSWindowsLinux

Confirms GitHub accepts your key.

ssh -T git@github.com

Install your key on a server

macOSLinux

Lets you log in without a password from now on.

ssh-copy-id @

Upload a file to a server

macOSWindowsLinux

Copies a file over SSH. Add -r for folders.

scp @:

Forward a remote port to your machine

macOSWindowsLinux

Open http://localhost:8080 to reach the server’s port 80 through an encrypted tunnel.

ssh -L :localhost: @

Fix "permissions are too open"

macOSLinux

SSH refuses private keys other users can read.

chmod 700 ~/.ssh && chmod 600 ~/.ssh/id_ed25519

Homebrew

Install, update and clean up Mac apps.

8 commands ›

Install Homebrew

macOSLinuxCareful

The official one-line installer from brew.sh.

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

Runs a script from the internet with your permissions. This is Homebrew’s official installer.

Update everything

macOSLinux

Refreshes Homebrew and upgrades all installed formulae and casks.

brew update && brew upgrade

Free space from old versions

macOSLinux

Removes old versions and the entire download cache.

brew cleanup --prune=all

Install a Mac app

macOS

Installs a GUI app. Search names with brew search.

brew install --cask

What’s installed

macOSLinux

All installed formulae and casks.

brew list

Diagnose problems

macOSLinux

Checks your setup and explains how to fix issues.

brew doctor

Run a background service

macOSLinux

Starts a database or server and keeps it running at login.

brew services start

Back up your installed apps

macOSLinux

Saves everything installed to a Brewfile. Restore on a new Mac with brew bundle --file=~/Brewfile.

brew bundle dump --file=~/Brewfile

Every command copies as plain, clean text: no curly quotes, no long dashes, no invisible characters.