Essential Ollama Commands: pull, run, list, ps, rm
Ollama has a small command set that covers everything from downloading a model to checking what is loaded in memory. Learn these eight commands and you can manage your whole local model library from the terminal.
pull: download a model
ollama pull llama3.2
ollama pull qwen2.5:7b
ollama pull downloads a model, or updates it if a newer version of that tag exists. A name without a tag uses the default tag, which the model's page defines. A name like qwen2.5:7b selects a specific size. Post 15 explains tags.
run: chat or answer once
ollama run llama3.2
ollama run llama3.2 "Summarise what DNS does in two lines."
Without a prompt you get an interactive session. With a prompt you get a single answer. You can also pipe text in, which is handy in scripts:
cat notes.txt | ollama run llama3.2 "Summarise this text in three bullets."
list: see downloaded models
ollama list
The output has columns for name, ID, size and modified time. Use it to find out what is eating your disk. The alias ollama ls also works.
show: inspect a model
ollama show llama3.2
ollama show llama3.2 --modelfile
The plain form prints architecture, parameter count, context length and quantization. The --modelfile flag prints the Modelfile the model was built from, which includes its template and default parameters. This is the best way to learn how a model is configured, and it is the starting point for post 34.
ps: what is loaded right now
ollama ps
Ollama keeps a model in memory for a while after the last request so the next one is fast. ollama ps lists loaded models, their size, whether they run on GPU or CPU, and when they will be unloaded. Check it first when something seems slow.
stop: unload a model
ollama stop llama3.2
This frees the memory immediately instead of waiting for the idle timeout. It does not delete the files. If your Ollama version does not have this command, upgrade, or wait for the timeout, which you can control with OLLAMA_KEEP_ALIVE.
cp: copy or rename
ollama cp llama3.2 my-assistant
This creates a new name that points to the same weights. It is useful as a starting point before you customise one copy with a Modelfile, and it does not duplicate the large files.
rm: delete a model
ollama rm qwen2.5:7b
This removes the model from disk. Shared layers used by other models stay until nothing uses them.
Other commands worth knowing
ollama createbuilds a model from a Modelfile (post 34).ollama servestarts the server in the foreground.ollama --helpandollama run --helplist every command and flag in your installed version. Always trust this over any blog post, including this one, because options change between releases.
A typical housekeeping routine
ollama list # what do I have?
ollama ps # what is loaded?
ollama rm old-model # free disk space
ollama pull llama3.2 # refresh a model I use often
Choosing between pull and run
Beginners often wonder which command to use first. They overlap, and the difference is small. Use pull when you want to download in advance, for example before a trip, on a slow connection, or in a setup script that prepares a server. Use run when you simply want to talk to a model and are happy to wait for a download if one is needed. In automation, prefer an explicit pull step so that a failed download shows up as its own clear error rather than as a confusing failure in the middle of a job.
Reading the list output
The size column in ollama list shows disk use, which is close to the memory the model needs when loaded, plus some extra for context. Sorting by size by eye is the fastest way to find which downloads to delete when the disk is nearly full. The ID column is a short hash of the model contents. Two names with the same ID are the same weights, which is what you see after a cp.
Common mistakes
- Pulling many large models and forgetting to remove them.
- Assuming a model is unloaded after the chat ends; it stays resident until the keep-alive time passes.
- Running two different big models at once and running out of memory.
- Using a bare name and being surprised which size you got. Specify the tag when it matters.
Comments
No comments yet. Have a question or a tip? Be the first to share it.