Ollama CLI Commands Cheat Sheet: Delete Models, Change Storage Path & Modelfiles (2026)
A few weeks after I started playing with local models, my laptop began complaining about low disk space. I had not installed anything big, or so I thought. It turned out I had pulled around eight different models "just to try", and Ollama was quietly sitting on tens of gigabytes. That was the day I actually sat down and learned the Ollama CLI properly instead of copy-pasting random commands from Reddit.
This page is the cheat sheet I wish I had that day. Every command here is something you will really use, with a short note on when and why. Bookmark it, and come back when you forget the syntax (we all do).
Quick Answer: The Ollama Commands You Need Most
| Command | What it does |
|---|---|
ollama pull llama3.2 | Download a model without running it |
ollama run llama3.2 | Start chatting (downloads first if needed) |
ollama list | Show all models installed on your machine |
ollama ps | Show models currently loaded in memory |
ollama show llama3.2 | Model details: size, parameters, template |
ollama rm llama3.2 | Delete a model and free disk space |
ollama cp llama3.2 my-copy | Duplicate a model under a new name |
ollama stop llama3.2 | Unload a running model from memory |
ollama create mymodel -f Modelfile | Build a custom model from a Modelfile |
ollama serve | Start the Ollama server manually |
Model names above are just examples. Swap in whichever model you use. Available commands can grow between versions, so run ollama --help if something here looks different on your machine.
Installing and Running Models
Pull a model
ollama pull llama3.2
This only downloads. I use it before a long flight or a bad-internet day so the model is ready offline.
Run a model
ollama run llama3.2
This opens an interactive chat. Type /bye to exit. If the model is not on your machine yet, Ollama pulls it first.
Run with a single prompt (no chat)
ollama run llama3.2 "Explain recursion in two sentences"
Great for scripts. It prints the answer and exits.
Useful run flags
ollama run llama3.2 --verbose
ollama run llama3.2 --keepalive 30m
ollama run llama3.2 --format json "Give me 3 fruits as JSON"
--verbose shows tokens per second after each answer, which is the easiest way to compare how fast different models run on your hardware. --keepalive controls how long the model stays in memory after you stop talking to it.
Ollama List: See Installed vs Running Models
This is the one that confused me at first, so let me make it simple.
ollama list
Shows every model downloaded on your disk, with its size and when it was last modified. Think of it as your library.
ollama ps
Shows only the models currently loaded in RAM or VRAM, and whether they are running on the GPU or CPU. Think of it as what is on your desk right now.
If your computer suddenly feels slow, ollama ps is the first thing to check. To unload a model without closing anything else:
ollama stop llama3.2
How to Delete Ollama Models and Free Up Disk Space
Deleting is permanent for that download, but you can always pull the model again later. Two steps:
ollama list
ollama rm llama3.2
Use the exact name shown in ollama list, including the tag (for example llama3.2:latest or qwen2.5:7b). You can remove several at once:
ollama rm llama3.2 mistral qwen2.5:7b
Tip from my own mess: sort out old test models regularly. A 7B model is usually a few GB, and a 70B model can eat well over 30 GB. Run ollama list once a month and be honest about what you actually use.
How to Change the Ollama Models Storage Directory
By default, Ollama saves models on your system drive. If that drive is small, move them with the OLLAMA_MODELS environment variable.
Default locations
- macOS:
~/.ollama/models - Windows:
C:\Users\<your-username>\.ollama\models - Linux (installed as a service):
/usr/share/ollama/.ollama/models
Windows
- Quit Ollama from the system tray.
- Open a terminal and run:
setx OLLAMA_MODELS "D:\ollama\models" - Reopen Ollama. New models will download to the new folder.
Linux (systemd)
sudo systemctl edit ollama.service
Add these lines in the editor that opens:
[Service]
Environment="OLLAMA_MODELS=/mnt/data/ollama/models"
Then give the Ollama user access to the folder and restart the service:
sudo mkdir -p /mnt/data/ollama/models
sudo chown -R ollama:ollama /mnt/data/ollama
sudo systemctl daemon-reload
sudo systemctl restart ollama
The permissions step is where most people get stuck. If Ollama cannot write to the folder, downloads fail with confusing errors.
macOS
launchctl setenv OLLAMA_MODELS /Volumes/External/ollama/models
Restart the Ollama app afterwards.
Important: changing the path does not move your existing models. Either copy the old folder contents to the new location, or just pull the models again.
Ollama Modelfile: Create a Custom Model with Your Own System Prompt
A common question is how to run Ollama with a system prompt. There is no single --system flag on ollama run, so there are two clean ways to do it.
Option 1: Set it inside a chat session
ollama run llama3.2
>>> /set system You are a patient Python tutor. Explain like I am a first-year B.Tech student.
Quick and temporary. It lasts only for that session.
Option 2: Save it permanently with a Modelfile
Create a plain text file named Modelfile:
FROM llama3.2
PARAMETER temperature 0.3
PARAMETER num_ctx 4096
SYSTEM """
You are a patient Python tutor for engineering students.
Explain step by step, use simple examples, and end with one practice question.
"""
Then build and run it:
ollama create python-tutor -f Modelfile
ollama run python-tutor
Now python-tutor shows up in ollama list like any other model. I keep a few of these: a code reviewer, a plain-English summarizer, and a strict JSON formatter. Lower temperature gives more predictable answers, higher gives more creative ones.
To see how any existing model is configured, and copy its setup as a starting point:
ollama show llama3.2 --modelfile
Other Handy Settings
OLLAMA_HOST: change the address and port the server listens on (default is127.0.0.1:11434). Set it to0.0.0.0to reach Ollama from another device on your network, but be careful, since that exposes it to that network.OLLAMA_KEEP_ALIVE: how long models stay loaded after use. Lower it if RAM is tight.ollama serve: starts the server manually. If you get a "port already in use" message, Ollama is probably already running in the background.
Common Problems and Quick Fixes
- "model not found": check the exact name and tag with
ollama list, or pull it first. - Very slow responses: run
ollama ps. If it says CPU, the model is probably too large for your GPU memory. Try a smaller size such as a 3B or 7B model. - Disk full: remove unused models with
ollama rm, or move the storage folder as shown above. - Cannot connect to the server: make sure Ollama is running, or start it with
ollama serve.
Frequently Asked Questions
How do I list all installed models in Ollama?
Run ollama list. It shows every downloaded model with its size and last-modified time. To see only models currently loaded in memory, use ollama ps instead.
How do I delete a model in Ollama?
Run ollama rm model-name, using the exact name from ollama list. This removes the model files from your disk and frees the space immediately.
What is the difference between ollama list and ollama ps?
ollama list shows models stored on disk. ollama ps shows models currently running in memory, along with whether they use the GPU or CPU.
How do I change where Ollama stores models?
Set the OLLAMA_MODELS environment variable to your preferred folder, then restart Ollama. On Linux with systemd, set it through sudo systemctl edit ollama.service and make sure the ollama user owns the folder.
Can I use ollama run with a system prompt?
Yes. For a temporary prompt, type /set system your prompt inside the chat. For a permanent one, add a SYSTEM line to a Modelfile and build it with ollama create.
How do I stop a running Ollama model?
Use ollama stop model-name to unload it from memory. Use /bye to leave an interactive chat.
Do I need a GPU to use Ollama?
No. Ollama runs on CPU too, just more slowly. Smaller models (around 3B to 8B parameters) work reasonably well on a modern laptop with 8 to 16 GB of RAM.
Where are Ollama models stored by default?
On macOS it is ~/.ollama/models, on Windows it is C:\Users\your-username\.ollama\models, and on Linux service installs it is usually /usr/share/ollama/.ollama/models.
Final Thoughts
You do not need to memorize everything. If you remember just list, ps, rm, and how to write a small Modelfile, you already handle 90% of daily Ollama use. Once that feels natural, the next step is choosing between Ollama and a GUI tool like LM Studio, and writing better system prompts for whichever one you use. I will cover both in upcoming posts here on Gyan Aangan.
Found a command I missed, or hit an error not listed above? Tell me in the comments and I will add it to this page.