Ollama CLI Commands
Master the core Ollama command line for running models, managing local weights, and chatting interactively.
TL;DR
- Download and chat with a model using
ollama run. - Audit local weights on disk with
ollama list. - Enter multi-line prompts by wrapping them in
"""quotes.
Run And Chat
ollama runStart an interactive chat, downloading the model first if needed.
ollama run llama3.2One-Shot PromptPass a prompt inline to print one answer and exit.
ollama run llama3.2 "Explain HTTP briefly"--verboseShow timing and tokens-per-second stats after each reply.
ollama run llama3.2 --verbose/byeEnd the interactive session and return to the shell.
>>> /byeManage Models
ollama pullDownload a model's weights without starting a chat.
ollama pull mistralollama listList local models with size and last-modified date.
ollama listollama psShow models currently loaded in memory right now.
ollama psollama showPrint a model's parameters, template, and license.
ollama show llama3.2ollama cpCopy a model under a new name for customization.
ollama cp llama3.2 my-llamaollama rmDelete a model's weights from disk permanently.
ollama rm mistralInteractive Commands
""" multi-lineWrap several lines in triple quotes to send one block.
>>> """
... first line of the prompt
... second line of the prompt
... """/set parameterChange a runtime setting like temperature for this session.
>>> /set parameter temperature 0.2/show infoDisplay details about the model in the current session.
>>> /show info/clearClear the conversation context without leaving the session.
>>> /clearTags And Custom Models
model:tagChoose a specific size or variant with a tag.
ollama run llama3.2:1b:latest defaultA bare name resolves to the latest tag automatically.
ollama run mistral # same as mistral:latestollama createBuild a custom model from a Modelfile recipe.
ollama create my-bot -f ModelfileTips
- Run
ollama pullahead of time to cache weights, so the firstollama runstarts chatting without a download wait. - Use
ollama psto see loaded models and their memory use before starting another, which avoids an out-of-memory stall.
Warnings
ollama rmdeletes a model's weights from disk permanently; you must runollama pullagain to get the model back.- A bare model name defaults to the
:latesttag, which can change over time; pin a specific tag for reproducible results.
In Practice
Audit downloaded models, inspect one, remove an unused model, then confirm the freed space.
ollama listshows every model and its size so you can spot big files.ollama showreveals a model's details before you decide to keep it.ollama rmfrees disk space, but it is permanent, so name the exact tag.- A final
ollama listconfirms the model is gone and space is reclaimed.
# See every model and its size on disk
ollama list
# Inspect one model's parameters and license
ollama show llama3.2
# Remove a model you no longer need
ollama rm old-model:latest
# Confirm it is gone
ollama listFAQ
Inside an interactive session, wrap the text in triple quotes. Type """, press enter, write as many lines as you need, then close with another """ to send the whole block.
Run ollama list to print every local model with its size and last-modified date. Use ollama ps instead to see only the models currently loaded in memory.
Run ollama rm to remove its weights from disk. This is permanent, so run ollama list first to confirm the exact name and tag you want to delete.
Type /bye at the >>> prompt to end the session and return to your shell. You can also press Ctrl+D to exit the interactive prompt.