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.

We ran every command below on Ollama 0.34.4 on an Apple M1 with 8 GB of memory and copied the real output. Windows and Linux steps come from the official docs (Source: Ollama CLI docs).

Key takeaways:

  • Daily loop: ollama pull, ollama run, ollama ps, ollama stop, ollama rm.
  • Config lives in env vars: OLLAMA_HOST (default 127.0.0.1:11434), OLLAMA_MODELS, OLLAMA_KEEP_ALIVE (default 5m), OLLAMA_CONTEXT_LENGTH.
  • Updating is per OS: the Mac and Windows apps update themselves; Linux re-runs the install script.
  • Models live in ~/.ollama/models on macOS, and in /usr/share/ollama/.ollama/models for the Linux service.

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 (Source: Ollama CLI docs).

CommandWhat it doesExampleKey flags
ollama runChat with a model, or answer one prompt and exit. Pulls the model first if missingollama run llama3.2 "Summarize this"--verbose, --keepalive 10m, --format json, --think, --hidethinking
ollama pullDownload a model or update it to the latest version of its tagollama pull qwen2.5:0.5b--insecure
ollama list / ollama lsList installed models with ID, size, and ageollama lsnone
ollama psList models loaded in memory, CPU/GPU split, context, and unload timeollama psnone
ollama showPrint architecture, parameters, context length, quantization, capabilitiesollama show qwen2.5:0.5b--modelfile, --parameters, --system, --template, --license, -v
ollama stopUnload a running model from memory nowollama stop llama3.2none
ollama rmDelete one or more models from diskollama rm my-model other-modelnone
ollama cpCopy a model under a new nameollama cp llama3.2 my-llamanone
ollama createBuild a custom model from a Modelfileollama create shell-helper -f Modelfile-f, -q/--quantize
ollama serve / ollama startStart the API server in the foregroundOLLAMA_HOST=0.0.0.0:11434 ollama serveconfigured by env vars
ollama pushUpload a model to a registryollama push username/my-model--insecure
ollama signin / signoutSign in to ollama.com for cloud models and pushingollama signinnone
ollama launchOpen the menu or start an integration such as Claude Code or Codexollama launch claude --model qwen3--model, --config
ollama -vPrint client and server versionollama -vnone

Measured in our test: ollama --help on 0.34.4 listed 15 subcommands, and ollama serve --help listed 21 environment variables, far more than any cheat sheet in the current top results.

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

The --verbose flag is the quickest speed check you have. It prints load time, prompt evaluation rate, and generation rate after every reply (Source: Ollama CLI docs).

Measured in our test: 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.

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. We sent each one through a real terminal session, and this is the menu /? printed:

Slash commandWhat it does
/set parameter temperature 0.1Change 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 quietTurn timing stats on or off
/set format json / /set noformatForce JSON output
/set think / /set nothinkToggle thinking on models that support it
/set nohistoryStop saving prompts to ~/.ollama/history
/show info, /show parameters, /show systemInspect 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
/clearClear the conversation context
/byeExit (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 into a reusable model without writing a Modelfile (Source: Ollama CLI docs).

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": our test model reported architecture qwen2, 494.03M parameters, context length 32768, quantization Q4_K_M, and the tools capability (Source: Ollama CLI docs).

Measured in our test: pulling the model took 136225 ms on our 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.

Measured in our test: ollama cp grew the model 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 we 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 --parameters

Measured in our test: ollama 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.

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, which means only your own machine can reach it (Source: Ollama envconfig source).

In our 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.

Measured in our test: 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 error is the one people search as "ollama serve error address already in use". 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 it

The 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 our model. Binding to 0.0.0.0 exposes an unauthenticated API, so keep it behind a firewall or reverse proxy (Source: Ollama FAQ).

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 (Source: Ollama envconfig source).

VariableWhat it controlsDefault
OLLAMA_HOSTServer bind address, and the address the client connects to127.0.0.1:11434
OLLAMA_MODELSFolder for model blobs and manifests~/.ollama/models
OLLAMA_KEEP_ALIVEHow long a model stays in memory after a request5m (-1 = forever, 0 = unload now)
OLLAMA_CONTEXT_LENGTHDefault context window0 = auto: 4k under 24 GiB VRAM, 32k at 24-48 GiB, 256k at 48 GiB+
OLLAMA_NUM_PARALLELParallel requests per loaded model1
OLLAMA_MAX_LOADED_MODELSModels loaded at the same timeauto (3 per GPU, or 3 on CPU)
OLLAMA_MAX_QUEUERequests queued before the server returns busy512
OLLAMA_ORIGINSExtra allowed browser origins (CORS)localhost, 127.0.0.1, 0.0.0.0
OLLAMA_FLASH_ATTENTIONEnable flash attentionoff
OLLAMA_KV_CACHE_TYPEK/V cache quantization (f16, q8_0, q4_0)f16
OLLAMA_LOAD_TIMEOUTGive up on a stalled model load after5m
OLLAMA_NO_CLOUDDisable cloud models and web searchoff
OLLAMA_NOHISTORYDo not save chat historyoff
OLLAMA_DEBUGVerbose server logsoff

The context default deserves a note. The FAQ still says 4096 tokens, while the source picks 4k, 32k, or 256k by available VRAM (Source: Ollama FAQ). On our 8 GB Mac, ollama show reported 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. On macOS with the app, use launchctl setenv OLLAMA_HOST "0.0.0.0:11434" and restart the app. On Linux, run sudo systemctl edit ollama, add Environment="OLLAMA_HOST=0.0.0.0:11434" under [Service], then sudo systemctl daemon-reload && sudo systemctl restart ollama. On Windows, quit Ollama, add the variable under "Edit environment variables for your account", and start it again (Source: Ollama FAQ).

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"}]}'

Measured in our test: 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 (Source: Ollama FAQ).

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). Updating depends on how you installed it. ollama pull <model> updates a model, not Ollama itself.

Install typeHow to update OllamaCheck it worked
macOS appUpdates download automatically; click the menu bar icon, then "Restart to update"ollama -v
macOS Homebrewbrew upgrade ollamaollama -v
Windows appUpdates download automatically; click the tray icon, then "Restart to update", or rerun OllamaSetup.exeollama -v in PowerShell
Linux (install script)curl -fsSL https://ollama.com/install.sh | sh (same command as install; models are kept)ollama -v
Dockerdocker pull ollama/ollama, then recreate the container with the same volumedocker exec ollama ollama -v

The Linux script removes the old lib/ollama folder and installs the new build, so your models under /usr/share/ollama survive (Sources: Ollama FAQ, Ollama Linux docs). 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.

On macOS, quit the app from the menu bar, then run the official cleanup (Source: 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 models

With 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 uninstaller does not delete models stored in a custom OLLAMA_MODELS folder, so delete that folder yourself, along with %HOMEPATH%\.ollama (Source: Ollama Windows docs).

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 models

The official docs remove the libraries with $(which ollama | tr 'bin' 'lib'). That trick swaps characters, not words, and it can produce the wrong path, which is reported in issue 14931. Naming the folder is safer (Source: Ollama Linux docs).

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 (Source: Ollama FAQ).

SetupDefault 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
WindowsC:\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.

Measured in our test: after ollama rm of the only model, the 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, our 8 GB RAM local LLM guide and local LLM hardware calculator size models against your memory.

FAQ

What are the commands for ollama?

The main Ollama commands are run, pull, list (or ls), ps, show, stop, rm, cp, create, serve, push, signin, signout, and launch. Run ollama --help for the list and ollama <command> --help for flags. Server settings such as port and model folder are environment variables, listed by ollama serve --help.

What is the ollama command to list models?

ollama list, or its alias ollama ls, lists every installed model with its name, ID, size on disk, and when it was last modified. To see only the models currently loaded in memory, with their CPU/GPU split and context size, use ollama ps. The API equivalent of ollama list is GET /api/tags on port 11434.

How to use ollama with CLI?

Install Ollama, then run ollama run <model>, for example ollama run llama3.2. It downloads the model if needed and opens a chat. Type /? for in-chat commands and /bye to exit. For scripts, pass the prompt as an argument, ollama run llama3.2 "your prompt", and it prints one answer and exits.

How to give ollama a system prompt?

Inside a chat, type /set system <your instructions>, then /save <name> to keep it as a model. For a permanent version, put SYSTEM <instructions> in a Modelfile and run ollama create <name> -f Modelfile. Through the API, send a system field with /api/generate, or a system-role message with /api/chat.

References