ollama pull MODEL (download), ollama run MODEL (chat), ollama list (what is installed), ollama ps (what is loaded and whether it is on the GPU), ollama stop MODEL (free the memory) and ollama rm MODEL (delete it from disk). Everything else, from changing the model folder to opening Ollama to your network, is done with environment variables such as OLLAMA_MODELS and OLLAMA_HOST.
Ollama commands cheat sheet
This is the full list that ollama --help prints in version 0.40.18, with what each one is for.
| Command | What it does |
|---|---|
ollama run MODEL | Starts a chat with a model, downloading it first if it is not on the machine. |
ollama run MODEL "prompt" | One answer, then back to the shell. Good for scripts. |
ollama pull MODEL | Downloads a model (or updates it) without starting a chat. |
ollama list or ollama ls | Lists the models stored on disk, with size and age. |
ollama ps | Lists the models loaded in memory right now, and how much is on GPU or CPU. |
ollama stop MODEL | Unloads a model from memory straight away. It stays on disk. |
ollama rm MODEL | Deletes a model from disk. |
ollama show MODEL | Shows architecture, size, context length, quantisation, capabilities and default parameters. |
ollama cp SOURCE TARGET | Copies a model under a new name (handy before editing it). |
ollama create NAME -f Modelfile | Builds a custom model from a Modelfile (base model, system prompt, parameters). |
ollama serve (alias ollama start) | Starts the Ollama server by hand. Not needed if the desktop app or the Linux service is running. |
ollama push NAME | Uploads your own model to a registry. |
ollama signin / ollama signout | Signs in to ollama.com (needed only for cloud models and publishing). |
ollama launch | Sets up and starts a supported app (Claude Code, Codex, OpenCode, VS Code, Droid) against an Ollama model. |
ollama -v | Prints the installed version. |
Two global flags are worth knowing: --verbose prints timings after each answer (load time, prompt speed and generation speed in tokens per second), and --nowordwrap stops the terminal wrapping long lines.
How to download a model in Ollama
Pick a name from the Ollama library and pull it. A name without a tag gets the latest tag; add a tag to choose a size or quantisation.
ollama pull qwen3.5:2b
ollama pull gemma4
According to the API documentation, a cancelled pull resumes from where it stopped, so you can press Ctrl+C on a slow download and run the same command later. Models from Hugging Face can be pulled by their full path, for example ollama pull hf.co/USER/REPO-GGUF:Q4_K_M; ollama list then shows them under that long name. The same GGUF files also run without Ollama in llama.cpp, using its -hf option.
Not sure which size your graphics card can hold? Will It Run? checks a model against your GPU or Mac, and the quantisation guide explains what tags like Q4_K_M and Q8_0 mean.
How to see which models are installed
ollama list shows what is on disk. On the test PC it printed:
NAME ID SIZE MODIFIED
qwen3.5:2b 0689d44085e0 2.7 GB 9 days ago
For the details of one model, use ollama show. For qwen3.5:2b it reported 1.9B parameters, a 262,144-token maximum context, Q8_0 quantisation, and the capabilities completion, vision, tools and thinking. That is the quickest way to check whether a model supports tools or images before you wire it into an app.
How to delete or remove a model
ollama rm qwen3.5:2b
Use the exact name from ollama list, including the tag. If the name is wrong you get Error: model 'name' not found, which is what the test PC returned for a made-up name. Removing a model frees the disk space; to free memory without deleting anything, use ollama stop instead. To uninstall a model through the API, send DELETE /api/delete with {"model": "name"}.
How to update Ollama and update models
Updating Ollama itself: on Windows and macOS the app downloads updates by itself. Click the Ollama icon in the taskbar or menu bar and choose Restart to update, or download the installer again from ollama.com/download. On Linux, run the install script again:
curl -fsSL https://ollama.com/install.sh | sh
Check the result with ollama -v. If the version printed by the command line and the server disagree, the old server is still running: quit the app or restart the service.
Updating a model: run ollama pull MODEL again. The pull fetches whatever the tag (for example gemma4:latest) currently points to in the library. The docs list no “update all” command; pull each model in ollama list that you want refreshed.
Is my model running on the GPU? (ollama ps)
Run a prompt, then ollama ps while the model is still loaded. On the test PC, after one short answer from qwen3.5:2b:
NAME ID SIZE PROCESSOR CONTEXT RUNNER UNTIL
qwen3.5:2b 0689d44085e0 2.4 GB 100% GPU 4096 llamacpp 4 minutes from now
- PROCESSOR:
100% GPUmeans the whole model is in video memory.100% CPUmeans it is all in system RAM. A split such as48%/52% CPU/GPUmeans it did not fit, and it will be much slower. - CONTEXT: the context window actually allocated. It was 4096 here, even though the model supports 262,144 (see the next section).
- UNTIL: when Ollama will unload the model. The default is 5 minutes after the last request.
To see speed, add --verbose. For that same one-sentence answer the test PC reported a load time of 4.2 seconds (the model was not in memory yet) and a generation rate of about 108 tokens per second. A 2B model on an 8 GB card is a small test; bigger models are much slower, and the tokens-per-second page covers what to expect.
How to stop a model or keep it loaded
ollama stop MODEL unloads it at once. To change how long models stay in memory, set OLLAMA_KEEP_ALIVE on the server (for example 10m, 24h, -1 to keep it loaded forever, or 0 to unload after every answer). For a single session, ollama run MODEL --keepalive 30m does the same. Through the API, the keep_alive field on /api/generate or /api/chat overrides the server setting; sending only the model name with "keep_alive": -1 preloads it.
How to increase the context length
Ollama does not give a model its full context by default. The current documentation says it picks the default from your video memory: 4k tokens under 24 GB of VRAM, 32k from 24 to 48 GB, and 256k at 48 GB or more. That is why the 8 GB test card showed 4096. The docs recommend at least 64,000 tokens for coding tools, agents and web search.
- Desktop app: move the context length slider in Settings.
- Server-wide:
OLLAMA_CONTEXT_LENGTH=64000 ollama serve, or set the variable permanently (see below). - Inside a chat:
/set parameter num_ctx 16384. - Per API request:
"options": {"num_ctx": 16384}.
A bigger context needs more memory. After changing it, run ollama ps again: if PROCESSOR drops below 100% GPU, the model now spills into system RAM. Setting OLLAMA_KV_CACHE_TYPE=q8_0 roughly halves the memory the context uses, with a very small loss in precision according to the docs.
Where Ollama stores models, and how to move them
| System | Default model folder |
|---|---|
| Windows | C:\Users\%username%\.ollama\models |
| macOS | ~/.ollama/models |
| Linux (install script) | /usr/share/ollama/.ollama/models |
To keep models on another drive, set OLLAMA_MODELS to the new folder and restart Ollama. On Linux the ollama user must own that folder: sudo chown -R ollama:ollama /path/to/models. On Windows the installer can also be put elsewhere with OllamaSetup.exe /DIR="D:\Ollama".
How to set Ollama environment variables
Every server setting is an environment variable, and it only takes effect when Ollama starts.
- Windows: quit Ollama from the taskbar, open Settings and search for environment variables, choose Edit environment variables for your account, add the variable, then start Ollama again from the Start menu.
- Linux (systemd): run
sudo systemctl edit ollama.service, add a line such asEnvironment="OLLAMA_HOST=0.0.0.0:11434"under[Service], thensudo systemctl daemon-reloadandsudo systemctl restart ollama. - macOS app:
launchctl setenv OLLAMA_HOST "0.0.0.0:11434", then restart the app.
ollama serve --help prints the full list for your version. The ones people change most:
| Variable | What it changes |
|---|---|
OLLAMA_HOST | Address and port. Default 127.0.0.1:11434 (this machine only). |
OLLAMA_MODELS | Where models are stored. |
OLLAMA_CONTEXT_LENGTH | Default context window (4k, 32k or 256k depending on VRAM). |
OLLAMA_KEEP_ALIVE | How long models stay loaded. Default 5 minutes. |
OLLAMA_NUM_PARALLEL | Requests each model handles at once. Each one adds context memory. |
OLLAMA_MAX_LOADED_MODELS | How many models can be loaded at the same time. |
OLLAMA_FLASH_ATTENTION | 1 forces Flash Attention on, 0 turns it off. Automatic otherwise. |
OLLAMA_KV_CACHE_TYPE | f16 (default), q8_0 or q4_0 to shrink context memory. |
OLLAMA_ORIGINS | Extra web origins allowed to call the API (browser extensions, web apps). |
OLLAMA_NO_CLOUD | 1 turns off cloud models and web search, for local-only use. |
OLLAMA_DEBUG | 1 adds detail to the server log, including GPU detection. |
The Ollama API: port 11434
Ollama’s server listens on http://localhost:11434. No API key is needed for a local install. Three quick checks:
curl http://localhost:11434/api/version
curl http://localhost:11434/api/tags
curl http://localhost:11434/api/generate -d '{"model":"qwen3.5:2b","prompt":"Why is the sky blue?","stream":false}'
/api/version returned {"version":"0.40.18"} on the test PC, and /api/tags returns the same models as ollama list. Ollama also answers OpenAI-style requests under /v1 (for example /v1/models and /v1/chat/completions), so most apps that accept a custom OpenAI base URL work with http://localhost:11434/v1. In PowerShell, curl may be an alias; use curl.exe or Invoke-WebRequest.
How to use Ollama from another computer
By default Ollama only accepts connections from the same machine. Set OLLAMA_HOST=0.0.0.0:11434 and restart it to listen on your network, then point the other device at http://THE-PC-IP:11434. There is no login on the local API, so keep it on your home network or behind a reverse proxy or VPN rather than opening the port to the internet. For a self-hosted chat front end on top, see the local LLM hub.
Common Ollama errors and fixes
Error: listen tcp 127.0.0.1:11434: bind: Only one usage of each socket address ... is normally permitted
You ran ollama serve while Ollama was already running (the desktop app or the service). This exact message appeared on the test PC. Nothing is broken: skip ollama serve and just use ollama run. If you need the server with different settings, quit the app first.
Error: model 'NAME' not found
The name or tag does not match anything installed. Copy it exactly from ollama list, or ollama pull it first.
The model runs on the CPU, or is very slow
Check ollama ps. If it shows a CPU share, the model plus its context does not fit in video memory: choose a smaller model or quantisation, or lower the context. If it shows 100% CPU on a machine with a supported NVIDIA card, update the driver (the Windows docs list 551.61 or newer) and look at the server log for GPU discovery errors. In Docker on Linux, GPU access needs the NVIDIA Container Toolkit.
503 overloaded
Too many requests are queued. Raise OLLAMA_MAX_QUEUE (default 512) or send fewer requests at once.
Squares instead of a progress bar on Windows 10
Older console fonts cannot draw the characters Ollama uses. Change the terminal font, or use Windows Terminal.
Where are the logs?
Windows: %LOCALAPPDATA%\Ollama\server.log (press Win+R and run explorer %LOCALAPPDATA%\Ollama). macOS: ~/.ollama/logs/server.log. Linux: journalctl -u ollama --no-pager --follow --pager-end. Set OLLAMA_DEBUG=1 for more detail.
How to uninstall Ollama
Windows: Settings, Apps, Installed apps, Ollama, Uninstall. If you moved models with OLLAMA_MODELS, that folder is left behind; delete it yourself. The default model folder is %HOMEPATH%\.ollama.
Linux (install script):
sudo systemctl stop ollama
sudo systemctl disable ollama
sudo rm /etc/systemd/system/ollama.service
sudo rm -r $(which ollama | tr 'bin' 'lib')
sudo rm $(which ollama)
sudo userdel ollama
sudo groupdel ollama
sudo rm -r /usr/share/ollama
The last line deletes every downloaded model, so copy anything you want to keep first.
FAQ
How do I see all Ollama commands?ollama --help lists them, and ollama COMMAND --help shows the flags for one, for example ollama run --help.
What is the difference between ollama stop and ollama rm?stop frees memory and keeps the files. rm deletes the files from disk.
Does Ollama need an API key?
Not for models running on your own machine. Signing in (ollama signin) is only for Ollama’s cloud models and for publishing models.
Does Ollama send my prompts anywhere?
The FAQ says local models run entirely on your machine and Ollama does not see the prompts. Cloud models are processed on Ollama’s servers. OLLAMA_NO_CLOUD=1 turns cloud features off.
How do I install a pre-release?
On Windows PowerShell: $env:OLLAMA_CHANNEL = "preview"; irm "https://ollama.com/install.ps1?channel=preview" | iex. On macOS or Linux: curl -fsSL 'https://ollama.com/install.sh?channel=preview' | OLLAMA_CHANNEL=preview sh.
Sources
- Ollama CLI reference
- Ollama FAQ (updates, environment variables, model folder, keep-alive, network access)
- Ollama context length
- Ollama on Windows and Ollama on Linux
- Ollama troubleshooting and API reference
- Ollama releases
Related guides
- Will It Run? Check a model against your GPU
- LLM quantisation explained (Q4_K_M, Q8_0, IQ4_XS)
- VRAM requirements by model size
- Local LLMs hub
Updated: 30 November 2026 (Ollama 0.40.18 tested, 0.40.19 current). Written with AI help from the sources listed.