HAP at a terminal, ready to help

HAP's Learning Lab

CLI Cheat Sheet

This is my personal cheat sheet. Every tool here is something I actually used while learning to live in the terminal. Some I learned the hard way. Some Grace taught me. Some I found by typing --help and reading what came back.

This is not a complete reference — it is a starting point. Prof. Teeters reminded me: the landscape changes fast. Review your workflows periodically. 🟠

Date-stamped: March 2026. CLI tools evolve. New ones appear. Old ones get new flags. Use this as a starting point, not a final answer. When something feels slow or awkward, ask Copilot if there is a better tool for the job.

Cross-platform: All commands here work in bash (Git Bash on Windows) and zsh (macOS). Platform-specific install commands are noted where they differ.

Navigation and File Commands

These are the commands from Stations 1 and 2 — the foundation everything else builds on.

pwd

Print Working Directory

Where am I right now? Always run this first.

pwd
# /Users/hap/projects/hap-7000
ls

List Directory Contents

What is in this directory? Add -la to see hidden files and details.

ls
ls -la    # long format, including hidden files
cd

Change Directory

Move around the file system. Always confirm with pwd after.

cd projects        # go into projects/
cd ..              # go up one level
cd ~               # go to home directory
cd -               # go back to previous directory
mkdir

Make Directory

Create a new folder. Use quotes or hyphens for names with spaces.

mkdir my-project
mkdir "my project"   # quotes if you need spaces
touch

Create a File

Creates an empty file. Check with ls to confirm it landed where you expected.

touch index.html
cat

Read a File

Dumps entire file to the terminal. Use less for large files.

cat README.md
less package.json   # paginated, press q to quit
cp

Copy a File

Makes a duplicate. Original stays where it is.

cp index.html backup.html
mv

Move or Rename

There is no rename command — mv does both jobs. The original is gone.

mv old-name.js new-name.js    # rename
mv file.js src/                 # move to src/
rm

Remove a File

No trash. No undo. No confirmation. Grace's rule: know what you are removing before you remove it.

rm temp.txt
rm -rf node_modules/   # recursive + force — be CERTAIN

Search Tools

Finding files and finding text inside files — two different jobs, two different tools.

find (files by name)

Search for files by name or pattern. Built into every system.

# find all .js files
find . -name "*.js"

# find files modified in last 24 hours
find . -mtime -1

fd (faster find)

A modern alternative to find. Faster, simpler syntax, respects .gitignore.

# find all .js files
fd ".js$"

# find files named "config"
fd config

Install:

# macOS
brew install fd
# Windows (Git Bash)
winget install sharkdp.fd
# Linux
apt install fd-find
# Note: binary installs as 'fdfind' — run: alias fd=fdfind

grep (text inside files)

Search for text patterns inside files. Built into every system.

# search for "TODO" in all .js files
grep -r "TODO" --include="*.js"

# case-insensitive search
grep -ri "error" src/

rg (faster grep)

ripgrep — a modern alternative to grep. Faster, respects .gitignore, better defaults.

# search for "TODO" in all .js files
rg "TODO" --type js

# case-insensitive search
rg -i "error" src/

Install:

# macOS
brew install ripgrep
# Windows (Git Bash)
winget install BurntSushi.ripgrep
# Linux
apt install ripgrep

Developer CLI Tools

These are the tools from Station 3 — the ones that reach beyond the local machine.

npm

Node Package Manager

npm run is a launcher — every script in package.json is a CLI tool with a nickname.

npm install            # install dependencies
npm run dev            # start dev server
npm run build          # production build
npm run lint           # run linter
npm run format         # run formatter
git

Version Control

Universal. Available on every platform — pre-installed on most macOS and Linux systems, and bundled with Git Bash on Windows. Agnostic to any host — works with GitHub, GitLab, anything.

git status             # what changed?
git add file.js        # stage a file
git commit -m "msg"    # save a snapshot
git push               # send to remote
git log --oneline      # recent history
gh

GitHub CLI

GitHub-specific — installed separately for PRs, issues, repos without leaving the terminal. git is version control. gh is GitHub.

gh repo view           # see repo info
gh issue list          # list issues
gh pr create           # create a pull request
gh pr status           # check PR status

Install:

# macOS
brew install gh
# Windows (Git Bash)
winget install GitHub.cli
# Linux
apt install gh
netlify

Netlify CLI

Deploy, preview, and manage Netlify sites from the terminal.

npm install -g netlify-cli
netlify deploy         # draft deploy
netlify deploy --prod  # production deploy
netlify status         # check connection
curl

Fetch URLs from the Terminal

See exactly what a server sends back — no browser, no rendering, no JavaScript. Useful for testing APIs and debugging responses.

curl https://example.com
curl -L https://example.com       # follow redirects
curl -I https://example.com       # headers only
curl -H "Authorization: Bearer TOKEN" https://api.github.com/user

Flags and Getting Help

Flags modify what a command does. Single dash for short flags (-f), double dash for long flags (--follow). Almost every command supports --help — the command can explain itself.

--help

Ask any command what it can do.

git --help
npm --help
netlify --help

Common flag patterns

Patterns you will see across many tools.

-r, --recursive    # apply to subdirectories
-f, --force        # skip confirmation
-v, --verbose      # show more detail
-q, --quiet        # show less detail
-n, --dry-run      # show what would happen

← Back to Learning Lab Hub

HAP waving goodbye