Quick Reference ยท CLI

Terminal Mastery

The ultimate side-by-side cheatsheet for Bash and PowerShell, packed with real-world developer examples. โšก

๐Ÿ“Œ Section
0%
Section 1 of 5

๐Ÿ“ Navigation & Discovery

Orient yourself in the terminal. These are the tools to figure out exactly where you are and what is around you.

ActionBash (Mac/Linux)PowerShell (Windows)
Print Working DirectorypwdGet-Location (or pwd)
List Files & FolderslsGet-ChildItem (or ls / dir)
Change DirectorycdSet-Location (or cd)
Go Back One Foldercd ..cd ..
Go to Home Directorycd ~cd ~
Clear the ScreenclearClear-Host (or clear / cls)
Example 1: The SNHU Project Deep Dive
# Jump straight from your home directory into your coursework folder
cd ~/Documents/SNHU_Projects/Software_Engineering

# Verify exactly where you landed
pwd

# List everything in this folder, including hidden config folders like .git
ls -la
Example 2: The Fast Escape
# You are 5 folders deep and want to back out quickly
# Go up one folder...
cd ..

# Go up TWO folders at once!
cd ../../

# Terminal getting messy? Wipe it clean.
clear
Section 2 of 5

๐Ÿ“‚ File & Folder Manipulation

The bread and butter of terminal work. Manage your project assets and scripts without ever touching a mouse.

ActionBash (Mac/Linux)PowerShell (Windows)
Make a Directorymkdirmkdir (or New-Item -ItemType Directory)
Create Empty Filetouchni (or New-Item)
Copy a Filecpcp (or Copy-Item)
Copy a Foldercp -rCopy-Item -Recurse
Move / Renamemvmv (or Move-Item)
Delete a Filermrm (or Remove-Item)
Delete a Folderrm -rfRemove-Item -Recurse -Force
Example 1: Scaffolding a Unity Project
# Create multiple folders at the exact same time
mkdir Scripts Prefabs Audio Materials

# Create two empty C# scripts instantly inside the Scripts folder
touch Scripts/GameManager.cs Scripts/AnimalController.cs
Example 2: Backups and Organization
# Copy a crucial UI script before making risky changes
cp UI_Controller.cs UI_Controller_BACKUP.cs

# Move a completed track into the Teq Vault music release folder
mv Towards_The_Light_Mix1.wav ../Releases/

# Oops, spelled it wrong. Let's rename it using the move command!
mv Towards_The_Light_Mix1.wav Towards_The_Light_Final.wav
Example 3: The Danger Zone (Use with caution)
# Delete a single old test build file
rm QUETIEMALS_Alpha_v1.apk

# FORCE delete an entire folder and everything inside it (No undo!)
rm -rf Old_Test_Project/
Section 3 of 5

๐Ÿ” Searching & Viewing

Quickly find specific lines of code or track down missing scripts directly from the command line without opening your IDE.

ActionBash (Mac/Linux)PowerShell (Windows)
View File Contentscatcat (or Get-Content)
Search Inside Filesgrepsls (or Select-String)
Find a File by Namefind . -nameGet-ChildItem -Filter -Recurse
View Log Updatestail -fGet-Content -Wait
Example 1: Reading Files on the Fly
# Check what dependencies your Python project needs without opening VS Code
cat requirements.txt
Example 2: The Code Detective (grep/sls)
# BASH: Find every line where the word "health" appears in the AnimalManager script
grep "health" AnimalManager.cs

# BASH: Find the word "biome" across ALL scripts in the current folder (case-insensitive)
grep -ri "biome" .

# POWERSHELL equivalent for the above
sls "biome" *.cs
Example 3: Finding Lost Files
# BASH: Find all custom OpenGL shader files nested anywhere inside this project
find . -name "*.glsl"

# POWERSHELL equivalent for finding files
Get-ChildItem -Filter "*.glsl" -Recurse
Section 4 of 5

โš™๏ธ System & Processes

Crucial commands for troubleshooting when an IDE hangs, or a local server port won't close.

ActionBash (Mac/Linux)PowerShell (Windows)
Show Running Processestop or htopgps (or Get-Process)
Kill a Processkill <PID>Stop-Process -Id <PID>
Check Network IPifconfig or ip aipconfig
Test Connectionpingping (or Test-Connection)
Example 1: Un-Freezing Your Workspace
# POWERSHELL: PyCharm has totally frozen. Find its process ID (PID)
gps -Name "pycharm*"

# Let's say the PID is 14032. Force quit it.
Stop-Process -Id 14032 -Force

# BASH: Same thing, finding the process
top
# Then kill it
kill -9 14032
Example 2: Network Diagnostics
# Find your local IP Address (useful for testing mobile games on your local WiFi)
# WINDOWS:
ipconfig

# MAC/LINUX:
ifconfig

# Test if your server (or the internet) is actually responding
ping google.com
๐Ÿ›‘
Emergency Stop If a script is caught in an infinite loop or a local testing server is running and you want to stop it, hit Ctrl + C. It acts as the universal emergency brake in the terminal.
Section 5 of 5

๐Ÿง‘โ€๐Ÿ’ป Developer Workflow

The daily routines. The most frequent command strings you'll use for version control and virtual environments.

๐Ÿ

Python VENVs

Bash: source venv/bin/activate
PS: .\venv\Scripts\Activate.ps1
Exit: deactivate

๐Ÿ“ฆ

Dependencies

Install your project requirements:
pip install -r requirements.txt

โšก

Pro-Tip: Chaining

Use && to run commands back-to-back.
git add . && git status

Example 1: The Daily Git Routine
# 1. Check what files you've modified today
git status

# 2. Stage all the changes to be saved
git add .

# 3. Commit the changes with a highly descriptive message
git commit -m "Refactored PyMongo CRUD module and updated Jupyter notebook tests"

# 4. Push to the remote repository (GitHub, GitLab, etc.)
git push origin main
Example 2: Setting up a Python Backend
# 1. Create a brand new virtual environment named "venv"
python -m venv venv

# 2. Turn it on (Windows PowerShell example)
.\venv\Scripts\Activate.ps1

# 3. Install packages safely inside the bubble
pip install pymongo

# 4. Turn it off when you're done for the day
deactivate
โŒจ๏ธ
Terminal Super-Trick Never type a full folder name. Type the first few letters (like cd QUE) and hit TAB. The terminal will auto-complete it for you. Also, use the Up Arrow to cycle through previously typed commands!
Roadmap