Module 4: Ollama - Introduction
Model Management with the Ollama CLI
Overview
You'll learn CLI commands to manage models: download, list, run, delete.
Time: 20 minutes
Difficulty: Low
🎯 Objectives
- ✅ Download models (
pull) - ✅ List models (
list) - ✅ Run models (
run) - ✅ Delete models (
rm)
📥 Command: ollama pull
Download Mistral 7B:
ollama pull mistral
Output:
pulling manifest
pulling 4a0346896...
pulling 4a0346897...
success
Time: 5-15 min (4GB download)
Available models:
# Browse at ollama.com/library
ollama pull mistral # 7B
ollama pull llama2 # 7B
ollama pull codellama # 7B for code
ollama pull llama2:13b # 13B (needs 16GB RAM)
📋 Command: ollama list
ollama list
Output:
NAME ID SIZE MODIFIED
mistral:latest 4a0346896 4.1 GB 2 minutes ago
llama2:latest 3f8a42d 3.8 GB 1 hour ago
🚀 Command: ollama run
Interactive mode:
ollama run mistral
Interactive chat:
>>> Hi, what model are you?
I'm Mistral 7B, running locally on your machine.
>>> /bye
Special commands:
/bye- Quit/show- Model info/set parameter value- Change parameters
🗑️ Command: ollama rm
ollama rm mistral
Confirms deletion of the model (frees 4GB)
📊 Command: ollama show
ollama show mistral
Output:
Model: mistral:latest
Family: mistral
Parameters: 7B
Quantization: Q4_0
Context: 32768
⚙️ Parameters in the CLI
ollama run mistral --temperature 0.7 --top-p 0.9
Available parameters:
--temperature(0-2)--top-p(0-1)--num-ctx(context window)--num-predict(max output tokens)
🔄 Update a Model
# Update to the latest version
ollama pull mistral
📊 Comparison: Ollama vs LM Studio
| Feature | Ollama CLI | LM Studio GUI |
|---|---|---|
| Download | ollama pull mistral | Click Download |
| Run | ollama run mistral | Click Load |
| List | ollama list | Home → My Models |
| Delete | ollama rm mistral | Click Delete |
| Automation | ✅ Scriptable | ❌ Manual |
Ollama advantage: Automatable (scripts, CI/CD)
🐛 Troubleshooting
Error: Model not found
# List available models
ollama list
# Or visit: https://ollama.com/library
Error: Not enough memory
Solution: Download a smaller quantized version:
ollama pull mistral:7b-q4 # Q4 (4-bit)
ollama pull mistral:7b-q2 # Q2 (2-bit, smaller)
✅ Summary
Essential commands:
ollama pull <model>- Downloadollama list- Listollama run <model>- Runollama rm <model>- Deleteollama show <model>- Info
Typical workflow:
ollama pull mistral
ollama list
ollama run mistral
# Interactive chat...
ollama rm mistral # If you no longer need it
Next: 04-api-rest-1.md
You'll learn to use Ollama as a REST API server (OpenAI-compatible).
Time: 25 min