A crash course for AI / Agent beginners. No theory -- just the commands and concepts you actually need. Updated 2026-07-22
- Shell / Terminal -- Your Command Center
- Git -- Version Control
- Node.js / npm -- JS Runtime & Package Manager
- Python / pip -- AI's Primary Language
- Docker -- Environment Isolation & Deploy
- Full Command Cheat Sheet
The shell translates your typed commands into actions the OS understands.
| OS | Default Shell | Terminal App |
|---|---|---|
| Windows | PowerShell / CMD | Windows Terminal |
| macOS | zsh (new) / bash (old) | Terminal.app |
| Linux | bash | Various |
This handbook uses bash/zsh syntax. Windows PowerShell equivalents are in the cheat sheet.
# Where am I?
pwd # Print working directory
# What's here?
ls # List files
ls -la # List all (including hidden), detailed
# Navigate
cd /path/to/folder # Enter a directory
cd .. # Go up one level
cd ~ # Go to home
cd - # Go to previous directory
# File operations
mkdir my-project # Create directory
touch README.md # Create empty file
cp source.txt dest.txt # Copy
mv old.txt new.txt # Move / rename
rm file.txt # Delete (WARNING: cannot undo)
rm -rf folder/ # Delete directory (WARNING: extremely dangerous)
# View files
cat file.txt # Print entire file
head -20 file.txt # First 20 lines
tail -f app.log # Live log tail (Ctrl+C to quit)
less file.txt # Page through (q to quit)
# Search
grep "error" app.log # Search keyword in file
grep -r "TODO" src/ # Recursive directory search| Shortcut | Action |
|---|---|
Ctrl+C |
Kill current program |
Ctrl+D |
Exit shell (EOF) |
Ctrl+L |
Clear screen |
Ctrl+R |
Search command history |
Ctrl+A / Ctrl+E |
Jump to start / end of line |
Tab |
Auto-complete filename or command |
Up / Down |
Navigate command history |
Git takes snapshots of your code every time you commit. With GitHub, you can collaborate, roll back mistakes, and track every change.
Working directory (where you edit)
| git add
v
Staging area (snapshot ready to commit)
| git commit
v
Local repo (.git directory)
| git push
v
Remote repo (GitHub / GitLab)
# === One-time setup ===
git config --global user.name "Your Name"
git config --global user.email "you@example.com"
# === Start a project ===
git init # Make current folder a git repo
git add . # Stage everything
git commit -m "Initial commit"
git remote add origin <URL> # Link to GitHub
git push -u origin main # Push to GitHub
# === Daily changes ===
git status # What files changed?
git diff # What exactly changed?
git add file.py # Stage specific file
git add . # Stage everything
git commit -m "Fix login bug"
git push # Push to remote
# === Pull others' changes ===
git pull # Fetch + merge
git fetch # Just check what's new (no merge)
# === Branches ===
git branch # Which branch am I on?
git checkout -b feature-x # Create + switch to new branch
git checkout main # Switch to main
git merge feature-x # Merge branch into current
# === Emergency ===
git log --oneline # View commit history
git stash # Stash current changes, go clean
git stash pop # Restore stashed changesTell Git what NOT to track:
node_modules/
__pycache__/
*.pyc
.env
.vscode/
dist/
build/
.DS_Store| Tool | Purpose |
|---|---|
| Node.js | Runs JavaScript on your computer (no browser needed) |
| npm | Node's package manager; downloads JS libraries |
| npx | Run an npm package temporarily without installing |
node --version # Should be >= 18
npm --versionmkdir my-agent && cd my-agent
npm init -y # Creates package.json (project identity)npm install axios # Install axios (HTTP client)
npm install -D typescript # -D = dev-only dependency
npm install -g wrangler # -g = global (CLI tools)
npm uninstall axios # Remove package
npm list # What's installed?
npm outdated # What needs updating?
npm update # Update everythingIn package.json:
{
"scripts": {
"dev": "node index.js",
"build": "webpack",
"test": "jest"
}
}npm run dev # Run dev script
npm test # test and start can omit "run"npm installdownloads everything tonode_modules/- Never commit this folder to Git (add to .gitignore)
- Others just run
npm installto rebuild frompackage.json
| Tool | Purpose |
|---|---|
| Python | AI ecosystem's dominant language |
| pip | Python's package manager |
| venv | Virtual environment (isolates dependencies per project) |
python --version # or python3 --version
pip --version # or pip3 --versionWhy? Different projects may need different versions of the same package. Mixing them breaks things.
# Create
python -m venv venv
# Activate (Windows)
venv\Scripts\activate
# Activate (macOS/Linux)
source venv/bin/activate
# Deactivate
deactivateWhen activated, your prompt shows (venv).
pip install requests # Install requests
pip install langchain openai # Install multiple
pip install -r requirements.txt # Batch install from file
pip list # What's installed?
pip freeze > requirements.txt # Export dependency listProject root file listing all dependencies:
langchain>=0.3.0
openai>=1.50.0
chromadb>=0.5.0
python-dotenv>=1.0.0
Others install everything with one command:
pip install -r requirements.txtDocker is like a shipping container with instructions. You pack your code + environment into an Image, and it runs identically anywhere. Solves "it works on my machine" forever.
| Concept | Explanation |
|---|---|
| Image | A packaged environment template (code + deps + system libs) |
| Container | A running instance of an image, isolated from others |
| Dockerfile | Instructions for building an image |
| docker-compose.yml | Orchestrate multiple containers |
| Docker Hub | Image registry (like npm for Node.js) |
# Status
docker --version # Is Docker installed?
docker ps # Running containers
docker ps -a # All containers (including stopped)
docker images # Local images
# Pull and run
docker pull python:3.12 # Pull Python 3.12 image
docker run -it python:3.12 bash # Run temporary container
# Build with Dockerfile
docker build -t my-agent:v1 . # Build image (don't forget the dot)
docker run -p 8080:8080 my-agent:v1 # Run, map ports
# Cleanup
docker stop <ContainerID> # Stop container
docker rm <ContainerID> # Remove container
docker rmi <ImageID> # Remove image
docker system prune -a # Clean ALL unused (WARNING)FROM python:3.12-slim
WORKDIR /app
COPY requirements.txt .
RUN pip install -r requirements.txt
COPY . .
CMD ["python", "main.py"]version: '3.8'
services:
app:
build: .
ports:
- "8080:8080"
env_file:
- .env
redis:
image: redis:7
ports:
- "6379:6379"docker-compose up -d # Start all services in background
docker-compose down # Stop and clean up
docker-compose logs -f # View logs| I want to... | Command |
|---|---|
| Current location | pwd |
| List files | ls -la |
| Enter directory | cd path |
| Create directory | mkdir name |
| Create file | touch name |
| Delete file | rm name |
| Delete directory | rm -rf dir |
| Copy | cp source dest |
| Move/Rename | mv old new |
| View file | cat file |
| Search content | grep "keyword" file |
| Admin privileges | Prefix with sudo |
| Kill program | Ctrl + C |
| Clear screen | Ctrl + L or clear |
| I want to... | Command |
|---|---|
| Init repo | git init |
| Check status | git status |
| Stage changes | git add . |
| Commit | git commit -m "message" |
| Push | git push |
| Pull | git pull |
| View history | git log --oneline |
| Create branch | git checkout -b name |
| Switch branch | git checkout name |
| Merge branch | git merge name |
| Clone repo | git clone URL |
| Stash changes | git stash / git stash pop |
| Discard changes | git checkout -- file |
| Link remote | git remote add origin URL |
| I want to... | Command |
|---|---|
| Init project | npm init -y |
| Install package | npm install pkg |
| Dev dependency | npm install -D pkg |
| Global install | npm install -g pkg |
| Uninstall | npm uninstall pkg |
| Run script | npm run script |
| Check versions | npm outdated |
| Update | npm update |
| I want to... | Command |
|---|---|
| Create venv | python -m venv venv |
| Activate (Mac/Linux) | source venv/bin/activate |
| Activate (Windows) | venv\Scripts\activate |
| Deactivate | deactivate |
| Install package | pip install pkg |
| Batch install | pip install -r requirements.txt |
| List packages | pip list |
| Export deps | pip freeze > requirements.txt |
| Run script | python file.py |
| I want to... | Command |
|---|---|
| Running containers | docker ps |
| All containers | docker ps -a |
| Local images | docker images |
| Pull image | docker pull image |
| Run container | docker run -p port:port image |
| Enter container | docker exec -it ID bash |
| Build image | docker build -t name:tag . |
| Stop container | docker stop ID |
| Remove container | docker rm ID |
| Remove image | docker rmi ID |
| Clean garbage | docker system prune -a |
| Compose up | docker-compose up -d |
| Compose down | docker-compose down |
| bash | PowerShell |
|---|---|
ls |
ls or Get-ChildItem |
cd |
cd or Set-Location |
pwd |
pwd or Get-Location |
mkdir |
mkdir or New-Item -ItemType Directory |
touch |
New-Item filename |
cat |
cat or Get-Content |
rm |
rm or Remove-Item |
cp |
cp or Copy-Item |
mv |
mv or Move-Item |
grep |
Select-String |
echo $VAR |
echo $env:VAR |
export VAR=val |
$env:VAR = "val" |
Almost every AI project needs API keys. Store them in .env:
# .env (NEVER commit to Git)
OPENAI_API_KEY=sk-xxxxxxxx
ANTHROPIC_API_KEY=sk-ant-xxxxxxxx
DEEPSEEK_API_KEY=sk-xxxxxxxxPython:
from dotenv import load_dotenv
import os
load_dotenv()
api_key = os.getenv("OPENAI_API_KEY")Node.js:
require('dotenv').config();
const apiKey = process.env.OPENAI_API_KEY;Use with Agent Tech Stack README. Bookmark and Ctrl+F anytime.