Ollama commands are the 15 subcommands of the ollama CLI: run, pull, list (ls), ps, show, stop, rm, cp, create, serve (start), push, signin, signout, launch, and help. Five cover daily use: ollama run <model> to chat, ollama pull to download, ollama list to see what is installed, ollama ps to see what is in memory, and ollama stop to free it. Server settings such as the port and model folder are environment variables (OLLAMA_HOST, OLLAMA_MODELS), not commands. There is no ollama update command.
I ran the core commands on Ollama 0.34.4 on an Apple M1 with 8 GB of memory, and the outputs and timings on this page are copied from that run. A few results stood out: a warm one-shot answer came back in 100 ms, ollama cp added only 4 KB to the model store, and a model that supports 32768 tokens was loaded with a 4096-token context. The Windows and Linux steps further down come from the official docs; I did not run them.
Ollama commands cheat sheet
This table is the whole CLI on one screen. The flags column lists the flags you will actually reach for, taken from each command's --help output in 0.34.4 and the Ollama CLI docs.
| Command | What it does | Example | Key flags |
|---|---|---|---|
ollama run | Chat with a model, or answer one prompt and exit. Pulls the model first if missing | ollama run llama3.2 "Summarize this" | --verbose, --keepalive 10m, --format json, --think, --hidethinking |
ollama pull | Download a model or update it to the latest version of its tag | ollama pull qwen2.5:0.5b | --insecure |
ollama list / ollama ls | List installed models with ID, size, and age | ollama ls | none |
ollama ps | List models loaded in memory, CPU/GPU split, context, and unload time | ollama ps | none |
ollama show | Print architecture, parameters, context length, quantization, capabilities | ollama show qwen2.5:0.5b | --modelfile, --parameters, --system, --template, --license, -v |
ollama stop | Unload a running model from memory now | ollama stop llama3.2 | none |
ollama rm | Delete one or more models from disk | ollama rm my-model other-model | none |
ollama cp | Copy a model under a new name | ollama cp llama3.2 my-llama | none |
ollama create | Build a custom model from a Modelfile | ollama create shell-helper -f Modelfile | -f, -q/--quantize |
ollama serve / ollama start | Start the API server in the foreground | OLLAMA_HOST=0.0.0.0:11434 ollama serve | configured by env vars |
ollama push | Upload a model to a registry | ollama push username/my-model | --insecure |
ollama signin / signout | Sign in to ollama.com for cloud models and pushing | ollama signin | none |
ollama launch | Open the menu or start an integration such as Claude Code or Codex | ollama launch claude --model qwen3 | --model, --config |
ollama -v | Print client and server version | ollama -v | none |
On 0.34.4, ollama --help listed 15 subcommands and ollama serve --help listed 21 environment variables.
How to run a model and chat from the command line
ollama run does two jobs. With only a model name, it opens an interactive chat. With a prompt in quotes, it prints one answer and exits, which is the form you use in scripts.
ollama run llama3.2 # interactive chat
ollama run llama3.2 "Explain DNS in one line" # one-shot answer
cat notes.txt | ollama run llama3.2 "Summarize:" # pipe a file in
ollama run llama3.2 --verbose "hi" # print timing stats after the answer--verbose is the quickest speed check you have: it prints load time, prompt evaluation rate, and generation rate after every reply. On my M1, a one-shot ollama run with --verbose took 921 ms including the model load and reported an eval rate of 166.21 tokens/s. The same command with the model already in memory took 100 ms.
The model stays loaded for five minutes by default, so a second prompt skips the load. A typo in the model name fails with Error: pull model manifest: file does not exist, which just means no model has that name.
If you would rather chat in a window than a terminal, the best Ollama GUI guide compares Ollama's desktop app with the front-ends that connect to the same server.
Slash commands inside ollama run
Once you are inside an ollama run chat, lines that start with / control the session instead of going to the model. I drove a real terminal session through /set, /show, /load, /save, /clear and /bye, and the table combines the menus that /? and /set printed:
| Slash command | What it does |
|---|---|
/set parameter temperature 0.1 | Change a sampling parameter for this session (also num_ctx, top_p, seed) |
/set system <text> | Replace the system prompt for this session |
/set verbose / /set quiet | Turn timing stats on or off |
/set format json / /set noformat | Force JSON output |
/set think / /set nothink | Toggle thinking on models that support it |
/set nohistory | Stop saving prompts to ~/.ollama/history |
/show info, /show parameters, /show system | Inspect the loaded model and your session changes |
/load <model> | Switch model without leaving the chat |
/save <name> | Save the session, including your /set changes, as a new local model |
/clear | Clear the conversation context |
/bye | Exit (Ctrl+D also works) |
""" | Start and end a multi-line message |
After /set parameter temperature 0.1, Ollama answered Set parameter 'temperature' to '0.1', and /show parameters listed it under "User defined parameters". /save my-chat-snapshot printed Created new model 'my-chat-snapshot', and the new model appeared in ollama list right away. That is the fastest way to turn a tuned chat, including a /set system prompt, into a reusable model without writing a Modelfile.
Manage models: pull, list, show, cp, rm, and create
Every model is a manifest pointing at content-addressed blobs, so copies and custom models reuse the same weights instead of duplicating them.
ollama pull downloads a model, and re-running it on an installed model only checks for a newer version of that tag. ollama list shows what is installed. ollama show answers "what is this model": my test model reported architecture qwen2, 494.03M parameters, context length 32768, quantization Q4_K_M, and the tools capability.
Pulling that model took 136225 ms on my connection. A repeat pull of the same tag took 1330 ms because it only compared manifests, and the model store was 380 MB on disk. ollama cp then grew the store by only 4 KB, because a copy writes a new manifest and points it at the same blobs.
ollama create builds a custom model from a Modelfile. This is the one I used:
FROM qwen2.5:0.5b
PARAMETER temperature 0.2
PARAMETER num_ctx 8192
SYSTEM You are a terse shell assistant. Answer with one command.ollama create shell-helper -f Modelfile
ollama show shell-helper --parametersollama create from that Modelfile finished in 90 ms, since it only wrote two small layers on top of the existing weights. Running ollama create without -f and without a ./Modelfile fails with Error: no Modelfile or safetensors files found. ollama rm takes several names at once, which is how I cleaned up the copy and the custom model.
Serve, ports, and OLLAMA_HOST
ollama serve starts the API server that every other command talks to. The desktop apps and the Linux systemd service run it for you, so you only start it by hand on a headless box or for testing. The default address is 127.0.0.1:11434, set in the envconfig source, which means only your own machine can reach it.
In my run, curl http://127.0.0.1:11434/ returned Ollama is running, while the same port on the machine's LAN address refused the connection. The server answered its first request 247 ms after launch, and a second ollama serve started while the first was running failed at once with a bind error:
Error: listen tcp 127.0.0.1:11434: bind: address already in use
That is the "ollama serve error address already in use" people search for. It almost always means the desktop app or systemd service is already serving. Quit the app, or run sudo systemctl stop ollama, before starting your own. To change the port or listen on the network, set OLLAMA_HOST:
OLLAMA_HOST=0.0.0.0:11434 ollama serve # reachable from other machines
OLLAMA_HOST=127.0.0.1:11500 ollama serve # different port
OLLAMA_HOST=127.0.0.1:11500 ollama list # point the client at itThe same variable points the client. With a second server on port 11500 and its own OLLAMA_MODELS folder, OLLAMA_HOST=127.0.0.1:11500 ollama list came back empty while the default server still listed my model. The Ollama FAQ is clear that binding to 0.0.0.0 exposes an unauthenticated API, so keep it behind a firewall or reverse proxy.
Ollama environment variables
Most Ollama configuration is environment variables read by the server, not flags. This table combines ollama serve --help from 0.34.4 with the defaults in the source code.
| Variable | What it controls | Default |
|---|---|---|
OLLAMA_HOST | Server bind address, and the address the client connects to | 127.0.0.1:11434 |
OLLAMA_MODELS | Folder for model blobs and manifests | ~/.ollama/models |
OLLAMA_KEEP_ALIVE | How long a model stays in memory after a request | 5m (-1 = forever, 0 = unload now) |
OLLAMA_CONTEXT_LENGTH | Default context window | 0 = auto: 4k under 24 GiB VRAM, 32k at 24-48 GiB, 256k at 48 GiB+ |
OLLAMA_NUM_PARALLEL | Parallel requests per loaded model | 1 |
OLLAMA_MAX_LOADED_MODELS | Models loaded at the same time | auto (3 per GPU, or 3 on CPU) |
OLLAMA_MAX_QUEUE | Requests queued before the server returns busy | 512 |
OLLAMA_ORIGINS | Extra allowed browser origins (CORS) | localhost, 127.0.0.1, 0.0.0.0 |
OLLAMA_FLASH_ATTENTION | Force Flash Attention on (1) | auto: used when the backend and GPU support it |
OLLAMA_KV_CACHE_TYPE | K/V cache quantization (f16, q8_0, q4_0); only applies while Flash Attention is active | f16 |
OLLAMA_LOAD_TIMEOUT | Give up on a stalled model load after | 5m |
OLLAMA_NO_CLOUD | Disable cloud models and web search | off |
OLLAMA_NOHISTORY | Do not save chat history | off |
OLLAMA_DEBUG | Verbose server logs | off |
The context default deserves a note. The FAQ still says 4096 tokens, while the source picks 4k, 32k, or 256k by available VRAM. On my 8 GB Mac, ollama show reported that the model supports 32768 tokens, but ollama ps showed it loaded with a 4096 context. If an agent or coding tool loses track of long files, raise OLLAMA_CONTEXT_LENGTH before blaming the model.
How you set these depends on how Ollama runs, and only the shell form was part of my test. According to the FAQ:
- macOS app: run
launchctl setenv OLLAMA_HOST "0.0.0.0:11434"and restart the app. - Linux service: run
sudo systemctl edit ollama, addEnvironment="OLLAMA_HOST=0.0.0.0:11434"under[Service], thensudo systemctl daemon-reload && sudo systemctl restart ollama. - Windows: quit Ollama, add the variable under "Edit environment variables for your account", and start it again.
Ollama commands on Windows
The commands themselves are identical in PowerShell, Command Prompt, and Windows Terminal; only the environment-variable syntax changes. For a one-off test in PowerShell, set the variable for that session and start the server from the same window:
$env:OLLAMA_HOST = "0.0.0.0:11434"
ollama serveThat setting disappears when the window closes, so use the account environment variables above for anything permanent. The Ollama Windows docs note that the app runs the server from the tray, so quit it first or the manual ollama serve hits the same "address already in use" error shown earlier.
Ollama REST API with curl
Every CLI command is a thin client over the REST API on port 11434, so anything you can do in the terminal you can script with curl.
curl http://localhost:11434/api/tags # like ollama list
curl http://localhost:11434/api/ps # like ollama ps
curl http://localhost:11434/api/generate -d '{
"model": "qwen2.5:0.5b", "prompt": "Why is the sky blue?", "stream": false }'
curl http://localhost:11434/api/generate -d '{"model": "qwen2.5:0.5b", "keep_alive": 0}' # unload
curl http://localhost:11434/v1/chat/completions -H "Content-Type: application/json" \
-d '{"model": "qwen2.5:0.5b", "messages": [{"role": "user", "content": "Say ok"}]}'A non-streaming /api/generate call returned 36 tokens with a total duration of 937 ms, and after a request with keep_alive set to 0, /api/ps listed 0 loaded models. The last call is the OpenAI-compatible endpoint. It returned a standard chat.completion object, so OpenAI SDK tools work with only a base URL change. To set a system prompt over the API, send a system field with /api/generate or a system-role message with /api/chat.
How to update Ollama on Mac, Windows, Linux, and Docker
No ollama update command exists in 0.34.4, and there is an open GitHub request to add one (issue 17219). ollama pull <model> updates a model, not Ollama itself. Updating Ollama depends on how you installed it; these steps come from the FAQ and the Ollama Linux docs, since my test used the standalone macOS build.
| Install type | How to update Ollama | Check it worked |
|---|---|---|
| macOS app | Updates download automatically; click the menu bar icon, then "Restart to update" | ollama -v |
| macOS Homebrew | brew upgrade ollama | ollama -v |
| Windows app | Updates download automatically; click the tray icon, then "Restart to update", or rerun OllamaSetup.exe | ollama -v in PowerShell |
| Linux (install script) | Rerun the install script piped to sh (command below the table; models are kept) | ollama -v |
| Docker | docker pull ollama/ollama, then recreate the container with the same volume | docker exec ollama ollama -v |
On Linux, the update command is the same as the install command: curl -fsSL https://ollama.com/install.sh | sh. The script removes the old lib/ollama folder and installs the new build, so your models under /usr/share/ollama survive. For the Docker path and keeping models in a named volume, see our Ollama Docker GPU setup guide. | sh. The script removes the old lib/ollama folder and installs the new build, so your models under /usr/share/ollama survive. For the Docker path and keeping models in a named volume, see our Ollama Docker GPU setup guide. |
How to uninstall Ollama
Uninstalling Ollama means removing the program and, separately, the model folder that holds the gigabytes. None of these steps were part of my test; they follow the official docs.
On macOS, quit the app from the menu bar, then run the cleanup from the Ollama macOS docs:
sudo rm -rf /Applications/Ollama.app
sudo rm /usr/local/bin/ollama
rm -rf ~/Library/Application\ Support/Ollama ~/Library/Caches/ollama
rm -rf ~/.ollama # deletes all modelsWith Homebrew, it is brew uninstall ollama followed by rm -rf ~/.ollama if you want the models gone too.
On Windows, remove Ollama from Settings, then "Add or remove programs". The Windows docs warn that the uninstaller does not delete models stored in a custom OLLAMA_MODELS folder, so delete that folder yourself, along with %HOMEPATH%\.ollama.
On Linux, stop the service and remove the binary, libraries, user, and data:
sudo systemctl stop ollama && sudo systemctl disable ollama
sudo rm /etc/systemd/system/ollama.service
sudo rm -r /usr/local/lib/ollama # or /usr/lib/ollama if installed under /usr
sudo rm $(which ollama)
sudo userdel ollama && sudo groupdel ollama
sudo rm -r /usr/share/ollama # deletes all modelsThe Linux docs remove the libraries with $(which ollama | tr 'bin' 'lib'). That trick swaps characters, not words, and it can produce the wrong path, as reported in issue 14931. Naming the folder is safer.
Ollama model list: installed vs available
ollama list only shows models already on your machine; the CLI in 0.34.4 has no command that searches the online catalog. To see every model you can download, browse ollama.com/search, which filters by capability (tools, vision, thinking, embedding, cloud) and sorts by popularity or date. Each model page lists its tags, and each tag has its own size and context length.
| You want | Command or place |
|---|---|
| Models installed on this machine | ollama list or curl localhost:11434/api/tags |
| Models loaded in memory right now | ollama ps |
| Size, context, quantization of one model | ollama show <model> |
| Every model available to download | ollama.com/search and the model's Tags page |
| A GGUF model from Hugging Face | ollama run hf.co/<user>/<repo>:<quant> |
The last row matters when the quant you want is not in the Ollama library. The Hugging Face Ollama docs document the hf.co/{username}/{repository}:{quantization} form, for example :Q8_0 or :IQ3_M, and the quantization name is case-insensitive. If you are deciding which quant to pull, our Q4_K_M vs Q5_K_M comparison covers the size and quality trade-off.
Where Ollama stores models
Ollama stores models as a blobs folder of weight files plus a manifests folder of names, under one models directory per OS. On my Mac the store under ~/.ollama/models had those two folders plus a metadata folder; the other paths come from the FAQ.
| Setup | Default model folder |
|---|---|
| macOS app or Homebrew | ~/.ollama/models |
| Linux, install script (systemd) | /usr/share/ollama/.ollama/models |
Linux, ollama serve as your user | ~/.ollama/models |
| Windows | C:\Users\%username%\.ollama\models |
| Docker | /root/.ollama/models inside the container, usually a named volume |
To move models to a bigger drive, set OLLAMA_MODELS for the server, restart it, and move or re-pull the models; on Linux the ollama user must be able to write there.
After ollama rm of the only model, my store dropped to 0 KB, so removing a model frees its blobs right away unless another model still references them. If you are choosing what to fill that folder with, the 8 GB RAM local LLM guide and the local LLM hardware calculator size models against your memory.
How I tested this
- Machine: Apple M1 with 8 GB of memory, macOS (Darwin 26.3, arm64).
- Version: Ollama 0.34.4, from the official standalone
ollama-darwin.tgzrelease (497 MB unpacked), not the desktop app or Homebrew. - Model:
qwen2.5:0.5b(Q4_K_M), the only model pulled. - Date: September 26, 2026.
- What I ran: a shell harness that started
ollama serveon the default port, then ranpull,list,ls,show,run(one-shot, piped and interactive with each slash command),ps,stop,cp,create,rm, the curl calls above, and a second server on port 11500 with its own models folder. - What I did not test:
push,signin,signout,launch, the desktop apps, Homebrew, Docker, and every Windows and Linux step on this page, which come from the docs. - Raw record: results.json, including the full interactive transcript.
Related coverage
References
- Ollama CLI docs - https://docs.ollama.com/cli
- Ollama envconfig source - https://github.com/ollama/ollama/blob/main/envconfig/config.go
- Ollama FAQ - https://docs.ollama.com/faq
- Ollama Linux docs - https://docs.ollama.com/linux
- Ollama macOS docs - https://docs.ollama.com/macos
- Ollama Windows docs - https://docs.ollama.com/windows

