HomeTerminal & Command LineTerminal Cheatsheet & Quick Reference
beginner8 min read· Module 3, Lesson 8

📋Terminal Cheatsheet & Quick Reference

Every command you need in one place — bookmark this lesson

Terminal Cheatsheet & Quick Reference

Welcome to your ultimate terminal reference guide. This lesson brings together every command you have learned throughout this module into organized, easy-to-scan tables. Bookmark this page — you will come back to it often.

Tip: You do not need to memorize every command. The best developers look things up all the time. What matters is knowing what is possible and where to find the answer quickly.


How to Read These Tables

Each table follows this format:

ColumnMeaning
CommandThe Mac/Linux terminal command
Windows EquivalentThe corresponding PowerShell or CMD command
DescriptionWhat the command does
ExampleA practical usage example

1. Navigation Commands

These commands help you move around the file system with confidence.

CommandWindows EquivalentDescriptionExample
pwdcd (no args)Print the current working directorypwd/Users/you/projects
lsdirList files and folders in the current directoryls
ls -ladir /aList all files including hidden ones, with detailsls -la
ls -lhdirList files with human-readable sizesls -lh
ls -Rdir /sList files recursively in subdirectoriesls -R src/
cd <dir>cd <dir>Change directory to the specified pathcd Documents/projects
cd ..cd ..Go up one directory levelcd ..
cd ~cd %USERPROFILE%Go to your home directorycd ~
cd -N/AGo back to the previous directorycd -
cd /cd \Go to the root directorycd /

Navigation Pro Tips

  • Use cd followed by dragging a folder into the terminal to auto-fill the path.
  • Type the first few letters of a directory name and press Tab to autocomplete.
  • Use pushd and popd to maintain a directory stack for quick back-and-forth navigation.

2. File Operations

The bread and butter of terminal work — creating, copying, moving, and deleting files.

Creating Files

CommandWindows EquivalentDescriptionExample
touch <file>New-Item <file>Create an empty file or update its timestamptouch index.html
touch file1 file2 file3New-Item file1, file2, file3Create multiple files at oncetouch app.js style.css
mkdir <dir>mkdir <dir>Create a new directorymkdir components
mkdir -p a/b/cmkdir -p a/b/c (PowerShell)Create nested directories at oncemkdir -p src/components/ui

Copying Files

CommandWindows EquivalentDescriptionExample
cp <src> <dest>copy <src> <dest>Copy a file to a new locationcp config.json config.backup.json
cp -r <src> <dest>xcopy <src> <dest> /sCopy a directory and all its contents recursivelycp -r templates/ my-project/
cp -i <src> <dest>N/ACopy with confirmation before overwritingcp -i important.txt backup/

Moving and Renaming Files

CommandWindows EquivalentDescriptionExample
mv <src> <dest>move <src> <dest>Move a file or directory to a new locationmv report.pdf Documents/
mv <old> <new>ren <old> <new>Rename a file or directorymv oldname.js newname.js
mv -i <src> <dest>N/AMove with confirmation before overwritingmv -i data.csv archive/

Deleting Files

CommandWindows EquivalentDescriptionExample
rm <file>del <file>Delete a file permanentlyrm temp.log
rm -r <dir>rmdir /s <dir>Delete a directory and all its contentsrm -r old-project/
rm -i <file>N/ADelete with confirmation promptrm -i important.doc
rm -rf <dir>rmdir /s /q <dir>Force delete without confirmation (use with caution!)rm -rf node_modules/

Warning: rm does not move files to Trash. They are gone permanently. Always double-check before running rm -rf.

Reading Files

CommandWindows EquivalentDescriptionExample
cat <file>type <file>Display the entire contents of a filecat README.md
head <file>Get-Content <file> -Head 10Display the first 10 lines of a filehead server.log
head -n 20 <file>Get-Content <file> -Head 20Display the first 20 lines of a filehead -n 20 data.csv
tail <file>Get-Content <file> -Tail 10Display the last 10 lines of a filetail error.log
tail -n 50 <file>Get-Content <file> -Tail 50Display the last 50 lines of a filetail -n 50 access.log
tail -f <file>Get-Content <file> -WaitFollow a file in real time (great for logs)tail -f server.log
less <file>more <file>View file contents page by page (scrollable)less package.json
wc -l <file>(Get-Content <file>).LengthCount the number of lines in a filewc -l index.js

3. Search Commands

Find files and content across your entire system or project.

CommandWindows EquivalentDescriptionExample
find . -name "*.js"dir /s *.jsFind files by name pattern in current directory treefind . -name "*.ts"
find . -type fdir /s /a:-dFind only files (not directories)find . -type f -name "*.md"
find . -type ddir /s /a:dFind only directoriesfind . -type d -name "node_modules"
find . -mtime -7N/AFind files modified in the last 7 daysfind . -mtime -7 -name "*.log"
find . -size +10MN/AFind files larger than 10 megabytesfind . -size +10M
grep "text" <file>findstr "text" <file>Search for a text pattern inside a filegrep "error" server.log
grep -r "text" <dir>findstr /s "text" <dir>/*Search recursively through all files in a directorygrep -r "TODO" src/
grep -i "text" <file>findstr /i "text" <file>Case-insensitive searchgrep -i "warning" output.log
grep -n "text" <file>findstr /n "text" <file>Show line numbers with matchesgrep -n "function" app.js
grep -c "text" <file>N/ACount the number of matching linesgrep -c "error" server.log
grep -l "text" *.jsN/AList only file names that contain the matchgrep -l "import" *.ts
which <cmd>where <cmd>Show the full path of a command executablewhich node
whereis <cmd>where <cmd>Locate binary, source, and man page for a commandwhereis python

Search Pro Tips

  • Combine find with grep: find . -name "*.js" -exec grep -l "useState" {} \;
  • Use grep -rn together to get both recursive search and line numbers.
  • Modern alternative: ripgrep (rg) is much faster than grep for large projects.

4. Permissions Commands

Control who can read, write, and execute files.

CommandWindows EquivalentDescriptionExample
chmod +x <file>N/AMake a file executablechmod +x deploy.sh
chmod 755 <file>N/ASet rwx for owner, rx for group and otherschmod 755 script.sh
chmod 644 <file>N/ASet rw for owner, read-only for group and otherschmod 644 config.json
chmod -R 755 <dir>N/AApply permissions recursively to a directorychmod -R 755 public/
chown <user> <file>icacls <file> /setowner <user>Change the owner of a filechown admin server.conf
chown -R <user>:<group> <dir>N/AChange owner and group recursivelychown -R www-data:www-data /var/www
sudo <command>Run as AdministratorExecute a command with superuser privilegessudo apt update
sudo -iN/AOpen an interactive root shellsudo -i
ls -laicacls <file>View file permissions in the listingls -la config/

Permission Number Reference

NumberPermissionSymbol
0No permission---
1Execute only--x
2Write only-w-
3Write + Execute-wx
4Read onlyr--
5Read + Executer-x
6Read + Writerw-
7Read + Write + Executerwx

Common patterns: 755 for scripts, 644 for config files, 600 for private keys.


5. System Commands

General-purpose commands for system information and daily terminal life.

CommandWindows EquivalentDescriptionExample
echo "text"echo textPrint text to the terminalecho "Hello World"
echo $VARIABLEecho %VARIABLE%Print the value of an environment variableecho $HOME
clearclsClear the terminal screenclear
historydoskey /historyShow a list of previously executed commandshistory
`historygrep "git"``doskey /historyfindstr "git"`
man <cmd><cmd> --help or help <cmd>Open the manual page for a commandman grep
<cmd> --help<cmd> /?Show quick help for a commandgit --help
whoamiwhoamiDisplay the current usernamewhoami
datedate /tDisplay the current date and timedate
calN/ADisplay a calendar for the current monthcal
uptime`systeminfofind "Boot Time"`Show how long the system has been running
df -hGet-PSDriveDisplay disk space usage in human-readable formatdf -h
du -sh <dir>`(Get-ChildItem -RecurseMeasure Length -Sum)`Show the total size of a directory
du -sh *N/AShow size of each item in the current directorydu -sh *
toptasklistDisplay running processes in real timetop
htoptaskmgrInteractive process viewer (enhanced top)htop
ps auxtasklistList all running processesps aux
kill <PID>taskkill /PID <PID>Terminate a process by its IDkill 12345
killall <name>taskkill /IM <name>Terminate all processes by namekillall node

6. Networking Commands

Test connections, download files, and work with remote servers.

CommandWindows EquivalentDescriptionExample
ping <host>ping <host>Test network connectivity to a hostping google.com
ping -c 5 <host>ping -n 5 <host>Send a specific number of ping requestsping -c 5 api.example.com
curl <url>Invoke-WebRequest <url>Transfer data from or to a servercurl https://api.github.com
curl -o <file> <url>Invoke-WebRequest -OutFile <file> <url>Download a file and save with a specific namecurl -o data.json https://api.example.com/data
curl -I <url>N/AFetch only the HTTP headerscurl -I https://example.com
curl -X POST -d '{"key":"val"}' <url>Invoke-RestMethod -Method POSTSend a POST request with datacurl -X POST -d '{"name":"test"}' http://localhost:3000/api
wget <url>Invoke-WebRequest -OutFileDownload a file from the internetwget https://example.com/file.zip
wget -r <url>N/ADownload an entire website recursivelywget -r https://docs.example.com
ssh <user>@<host>ssh <user>@<host>Connect to a remote server via SSHssh deploy@192.168.1.100
ssh -p <port> <user>@<host>ssh -p <port> <user>@<host>Connect to SSH on a non-default portssh -p 2222 admin@server.com
scp <file> <user>@<host>:<path>scp <file> <user>@<host>:<path>Securely copy files to a remote serverscp build.zip deploy@server:/var/www/
ifconfig / ip addripconfigShow network interface informationifconfig
netstat -annetstat -anShow active network connections and ports`netstat -an
lsof -i :<port>`netstat -anofindstr :<port>`Find which process is using a specific port

7. Keyboard Shortcuts

Speed up your workflow dramatically with these shortcuts.

ShortcutWindows Terminal EquivalentDescription
TabTabAutocomplete file and directory names
Tab TabTab TabShow all possible completions
Ctrl + CCtrl + CCancel the current running command
Ctrl + DCtrl + DExit the current shell session
Ctrl + ZN/ASuspend the current process (resume with fg)
Ctrl + LCtrl + LClear the terminal screen (same as clear)
Ctrl + RCtrl + RReverse search through command history
Ctrl + AHomeMove cursor to the beginning of the line
Ctrl + EEndMove cursor to the end of the line
Ctrl + WCtrl + BackspaceDelete the word before the cursor
Ctrl + UN/ADelete everything before the cursor
Ctrl + KN/ADelete everything after the cursor
Ctrl + YN/APaste the last deleted text
Alt + BCtrl + LeftMove cursor back one word
Alt + FCtrl + RightMove cursor forward one word
Up ArrowUp ArrowRecall the previous command from history
Down ArrowDown ArrowGo forward in command history
!!N/ARepeat the last command
!$N/AUse the last argument of the previous command
Ctrl + Shift + CCtrl + Shift + CCopy selected text in terminal
Ctrl + Shift + VCtrl + Shift + VPaste text into terminal

8. Package Managers

Install and manage software from the command line.

System Package Managers

CommandPlatformDescriptionExample
brew install <pkg>macOSInstall a package via Homebrewbrew install git
brew updatemacOSUpdate Homebrew package listbrew update
brew upgrademacOSUpgrade all installed packagesbrew upgrade
brew listmacOSList all installed Homebrew packagesbrew list
brew uninstall <pkg>macOSRemove a Homebrew packagebrew uninstall wget
brew search <pkg>macOSSearch for a package in Homebrewbrew search python
apt updateLinux (Debian/Ubuntu)Update the package indexsudo apt update
apt install <pkg>Linux (Debian/Ubuntu)Install a packagesudo apt install nodejs
apt upgradeLinux (Debian/Ubuntu)Upgrade all installed packagessudo apt upgrade
apt remove <pkg>Linux (Debian/Ubuntu)Remove a packagesudo apt remove firefox
apt search <pkg>Linux (Debian/Ubuntu)Search for a packageapt search python3
apt list --installedLinux (Debian/Ubuntu)List all installed packagesapt list --installed

Developer Package Managers

CommandEcosystemDescriptionExample
npm install <pkg>Node.jsInstall a Node.js package locallynpm install express
npm install -g <pkg>Node.jsInstall a Node.js package globallynpm install -g typescript
npm init -yNode.jsInitialize a new Node.js projectnpm init -y
npm run <script>Node.jsRun a script defined in package.jsonnpm run build
npm listNode.jsList installed packagesnpm list --depth=0
npm uninstall <pkg>Node.jsRemove a packagenpm uninstall lodash
npm outdatedNode.jsCheck for outdated packagesnpm outdated
pip install <pkg>PythonInstall a Python packagepip install requests
pip install -r requirements.txtPythonInstall packages from a requirements filepip install -r requirements.txt
pip listPythonList installed Python packagespip list
pip uninstall <pkg>PythonRemove a Python packagepip uninstall flask
pip freezePythonOutput installed packages in requirements formatpip freeze > requirements.txt

Windows Package Manager

CommandDescriptionExample
choco install <pkg>Install a package via Chocolateychoco install git
choco upgrade allUpgrade all Chocolatey packageschoco upgrade all
winget install <pkg>Install a package via Windows Package Managerwinget install Microsoft.VisualStudioCode
winget upgrade --allUpgrade all winget packageswinget upgrade --all

9. Environment Variables

Configure your shell environment and manage variables.

CommandWindows EquivalentDescriptionExample
export VAR=valueset VAR=valueSet an environment variable for the current sessionexport NODE_ENV=production
export PATH=$PATH:/new/pathset PATH=%PATH%;C:\new\pathAdd a directory to the PATHexport PATH=$PATH:$HOME/.local/bin
echo $VARecho %VAR%Display the value of a variableecho $HOME
echo $PATHecho %PATH%Display the current PATHecho $PATH
envsetList all environment variablesenv
printenv VARecho %VAR%Print a specific environment variableprintenv HOME
unset VARset VAR=Remove an environment variableunset DEBUG
source ~/.bashrcN/AReload the shell configuration filesource ~/.zshrc
source .envN/ALoad variables from a .env file into the sessionsource .env
. ~/.profileN/AAlternative syntax for source. ~/.bash_profile

Making Variables Permanent

To keep environment variables across sessions, add them to your shell configuration file:

  • Bash: Add export VAR=value to ~/.bashrc or ~/.bash_profile
  • Zsh: Add export VAR=value to ~/.zshrc
  • Windows: Use System Properties > Environment Variables, or setx VAR value in CMD

10. Redirection & Piping

Combine commands and control input/output like a pro.

CommandWindows EquivalentDescriptionExample
cmd > filecmd > fileRedirect output to a file (overwrite)echo "hello" > greeting.txt
cmd >> filecmd >> fileAppend output to a fileecho "world" >> greeting.txt
cmd 2> filecmd 2> fileRedirect error output to a filenode app.js 2> errors.log
cmd &> filecmd > file 2>&1Redirect both stdout and stderr to a filenpm build &> build.log
`cmd1cmd2``cmd1cmd2`
cmd1 && cmd2cmd1 && cmd2Run cmd2 only if cmd1 succeedsnpm test && npm run build
`cmd1cmd2``cmd1
cmd1 ; cmd2cmd1 & cmd2Run cmd2 after cmd1 regardless of successmkdir dist ; cp files dist/

Quick Reference Card

The 10 Commands You Will Use Every Day

#CommandWhat It Does
1cd <dir>Navigate to a directory
2ls -laSee what is in the current directory
3cat <file>Read a file quickly
4touch <file>Create a new file
5mkdir <dir>Create a new directory
6cp <src> <dest>Copy a file
7mv <src> <dest>Move or rename a file
8rm <file>Delete a file
9grep "text" <file>Search inside a file
10historySee what you ran before

The 5 Shortcuts That Save the Most Time

#ShortcutWhat It Does
1TabAutocomplete — stops typos
2Ctrl + CCancel — your emergency exit
3Ctrl + RSearch history — find old commands instantly
4Up ArrowRecall — repeat last commands
5Ctrl + LClear — clean slate for focus

What Comes Next

Congratulations! You have completed the Terminal & Command Line module. You now have a solid foundation in:

  • Navigating the file system with confidence
  • Creating, copying, moving, and deleting files
  • Searching for files and content
  • Managing permissions and using sudo
  • Monitoring system resources
  • Working with networking tools
  • Using keyboard shortcuts for speed
  • Managing packages across platforms
  • Configuring environment variables

You are ready for Claude Code CLI! In the next module, you will put these terminal skills to work by learning the Claude Code command-line interface — the tool that brings AI-powered coding directly into your terminal workflow. Everything you learned here will make that experience smooth and productive.

Remember: This cheatsheet is always here for you. Come back whenever you need a quick refresher. The best developers are not the ones who memorize everything — they are the ones who know where to find the answer.