Ollama commands: the cheat sheet
How-toBy Lucas Matías García TorresUpdated and checked 5 min read
Reviewed by Lucas Matías García Torres on . How we work.

Short answer
The Ollama commands you need most are ollama run to start a model, pull to download it, ls to list models, ps to see what is loaded, stop to unload it and rm to delete it. The CLI reference also covers create, serve, launch, signin and signout. The local server listens on 127.0.0.1:11434, models stay loaded for five minutes by default and environment variables such as OLLAMA_MODELS and OLLAMA_KEEP_ALIVE change the behavior.
Prices and limits change often: check the vendor's page before you pay. How we make money.
Ollama commands are few and easy to remember: ollama run starts a model, ollama pull downloads one, ollama ls lists what you have, ollama ps shows what is loaded, ollama stop unloads it and ollama rm deletes it. This cheat sheet lists every command in Ollama's CLI reference, the environment variables from its FAQ and the addresses of its local API, as documented on October 6, 2026. If you have not installed Ollama yet, start with how to run an LLM locally.
Which Ollama commands do you need most?
Table: the Ollama command line (from Ollama's CLI reference)
| Command | What it does | Example |
|---|---|---|
ollama run |
Runs a model and opens a chat | ollama run gemma4 |
ollama pull |
Downloads a model | ollama pull gemma4 |
ollama ls |
Lists all downloaded models | ollama ls |
ollama ps |
Shows the models that are loaded and running | ollama ps |
ollama stop |
Stops a running model and frees its memory | ollama stop gemma4 |
ollama rm |
Removes a downloaded model | ollama rm gemma4 |
ollama create |
Builds a customized model from a Modelfile | ollama create -f Modelfile |
ollama serve |
Starts the Ollama server; --help shows its environment variables |
ollama serve |
ollama launch |
Configures and launches an external app that uses Ollama models | ollama launch claude |
ollama signin / ollama signout |
Logs in to or out of Ollama | ollama signin |
The reference gives gemma4 as its example model; any model name from the Ollama library works in the same way, for instance qwen3:8b. For the full list of options on your installed version, run ollama --help.
How do you run, download and remove a model?
ollama run gemma4 starts a chat with the model. ollama pull gemma4 only downloads it, which is useful before you go offline. ollama ls shows what you have on disk so you can decide what to delete, and ollama rm gemma4 removes a model and frees the space. Which model to pick depends on your memory; our VRAM calculator and GPU guide show what fits.
How do you see what is running, and free the memory?
ollama ps lists the loaded models and, in the PROCESSOR column, whether they run on the GPU: "100% GPU" means the whole model is in video memory, and any other split means part of it runs on the CPU, which is slower. By default a model stays loaded for five minutes after its last use. To unload it at once, run ollama stop followed by the model name. To keep a model loaded, set keep_alive to a negative number such as -1 in the API or with the OLLAMA_KEEP_ALIVE variable, and to unload it immediately after a request set keep_alive to 0.
Which environment variables does Ollama use?
Set a variable before you start the server, for example OLLAMA_CONTEXT_LENGTH=64000 ollama serve. Ollama's FAQ lists these:
Table: Ollama environment variables (from the FAQ)
| Variable | What it does | Default |
|---|---|---|
OLLAMA_HOST |
Changes the address the server binds to | 127.0.0.1:11434 |
OLLAMA_MODELS |
Folder where models are stored | Depends on the system |
OLLAMA_CONTEXT_LENGTH |
Overrides the default context window | See the context window guide |
OLLAMA_KEEP_ALIVE |
How long a model stays loaded | 5 minutes |
OLLAMA_NUM_PARALLEL |
Maximum parallel requests per model | 1 |
OLLAMA_MAX_LOADED_MODELS |
Maximum models loaded at once | 3 times the number of GPUs (3 on CPU) |
OLLAMA_MAX_QUEUE |
Maximum queued requests when busy | 512 |
OLLAMA_FLASH_ATTENTION |
Turns Flash Attention on or off | Automatic |
OLLAMA_KV_CACHE_TYPE |
Quantization of the key-value cache: f16, q8_0 or q4_0 |
f16 |
OLLAMA_NO_CLOUD |
Turns off Ollama's cloud features | Cloud on |
HTTPS_PROXY |
Proxy used for model downloads | None |
Lowering the cache type from f16 to q8_0 roughly halves the memory the cache uses, which can let a longer context fit.
Where does Ollama store its models?
On macOS the models are in ~/.ollama/models, on Linux in /usr/share/ollama/.ollama/models and on Windows in C:\Users\%username%\.ollama\models. Set OLLAMA_MODELS to a different folder if your system drive is small.
How do you use the Ollama API from other programs?
When the server runs, Ollama listens on http://localhost:11434. Its native API lives under http://localhost:11434/api. Ollama's documentation shows a chat request for its cloud service and says you can use it locally by replacing the URL with http://localhost:11434/api/chat and removing the authorization header, which gives a request like this:
curl http://localhost:11434/api/chat -H "Content-Type: application/json" -d '{"model": "gemma4", "messages": [{"role": "user", "content": "Why is the sky blue?"}], "stream": false}'
Tools written for other APIs can use Ollama too. For OpenAI-compatible clients, the base URL is http://localhost:11434/v1/ and the API key is a placeholder (ollama) that Ollama ignores; it supports chat completions, completions, models, embeddings and responses endpoints. For Anthropic-compatible clients, the base URL is http://localhost:11434 with the key ollama, and for Claude Code the documentation sets ANTHROPIC_AUTH_TOKEN=ollama and ANTHROPIC_BASE_URL=http://localhost:11434. Ollama supports a subset of each API, so check the compatibility pages if a feature is missing.
Can Ollama create embeddings and launch other tools?
Yes. Embedding models run with the same command: ollama run embeddinggemma "Hello world" or, with a pipe, echo "Hello world" | ollama run nomic-embed-text. Embeddings are the building block of retrieval-augmented generation. And ollama launch connects other applications to Ollama models: ollama launch claude starts Claude Code, ollama launch claude --model qwen3.5 chooses the model, and ollama launch droid --config configures an integration without starting it.
How do you fix common problems with these commands?
- Answers are slow: run
ollama ps. A split between CPU and GPU means the model does not fit; use a smaller model or a more compressed one. - The computer runs out of memory: run
ollama stopon models you are not using, or lowerOLLAMA_MAX_LOADED_MODELSand the context length. - The disk is full: run
ollama ls, thenollama rmon the models you no longer use. - A program cannot connect: check that
ollama serveis running and that the program points to127.0.0.1:11434, or to the address you set inOLLAMA_HOST. - You want to compare runners: see Ollama vs LM Studio.
What we checked
- Ollama's CLI reference lists ollama run, ollama launch (for example ollama launch claude, ollama launch claude --model qwen3.5 and ollama launch droid --config), ollama run embeddinggemma and echo piped to ollama run nomic-embed-text for embeddings, ollama pull, ollama rm, ollama ls, ollama signin and signout, ollama create -f Modelfile, ollama ps, ollama stop and ollama serve. (Ollama (GitHub docs), )
- Ollama's FAQ lists OLLAMA_HOST (default 127.0.0.1:11434), OLLAMA_MODELS, OLLAMA_CONTEXT_LENGTH, OLLAMA_KEEP_ALIVE (5 minutes), OLLAMA_NUM_PARALLEL (1), OLLAMA_MAX_LOADED_MODELS (3 times the number of GPUs, or 3 for CPU), OLLAMA_MAX_QUEUE (512), OLLAMA_FLASH_ATTENTION (automatic), OLLAMA_KV_CACHE_TYPE (f16, q8_0 or q4_0; default f16), OLLAMA_NO_CLOUD and HTTPS_PROXY. (Ollama, )
- Models are stored in ~/.ollama/models on macOS, /usr/share/ollama/.ollama/models on Linux and C:\Users\%username%\.ollama\models on Windows; a model stays loaded for 5 minutes by default; ollama stop unloads it; keep_alive set to -1 keeps it loaded and 0 unloads it immediately. (Ollama, )
- A larger context length increases the memory required; OLLAMA_CONTEXT_LENGTH=64000 ollama serve sets it; ollama ps showing 100% GPU under PROCESSOR indicates no CPU offloading. (Ollama, )
- The local API base URL is http://localhost:11434/api; the documentation's chat example for the cloud service can be used locally by substituting http://localhost:11434/api/chat and removing the authorization header. (Ollama, )
- For OpenAI-compatible access the base URL is http://localhost:11434/v1/, the API key is the placeholder ollama, and chat completions, completions, models, embeddings and responses endpoints are supported. (Ollama, )
- For Anthropic-compatible access the base URL is http://localhost:11434 with the placeholder key ollama; for Claude Code the documentation sets ANTHROPIC_AUTH_TOKEN to ollama and ANTHROPIC_BASE_URL to http://localhost:11434. (Ollama, )
What may change
- Ollama adds and renames commands and environment variables between releases; this page is reviewed quarterly.
- Model names in the library change; use ollama ls to see the exact names you have.
Frequently asked questions
What are the basic Ollama commands?
The basic commands are ollama run to start a model, ollama pull to download one, ollama ls to list downloaded models, ollama ps to list running models, ollama stop to stop one and ollama rm to delete one. ollama serve starts the server, ollama create builds a model from a Modelfile and ollama launch connects other apps.
How do I list my Ollama models?
Run ollama ls. It displays every model you have downloaded. To see only the models that are currently loaded in memory, and whether they run on the GPU, use ollama ps and look at the PROCESSOR column, where 100% GPU means the whole model is in video memory.
How do I stop an Ollama model?
Run ollama stop followed by the model name, for example ollama stop gemma4, to unload it and free its memory. Otherwise a model stays loaded for five minutes after its last use by default. Setting keep_alive to -1 keeps it loaded, and setting it to 0 unloads it immediately after the request.
How do I delete an Ollama model?
Run ollama rm followed by the model name, for example ollama rm gemma4. Use ollama ls first to see the names and decide what to remove. The files live in the models folder, which you can move with the OLLAMA_MODELS environment variable.
Where does Ollama store models?
On macOS models are stored in ~/.ollama/models, on Linux in /usr/share/ollama/.ollama/models and on Windows in C:\Users\%username%\.ollama\models. Set the OLLAMA_MODELS environment variable to use another folder, for example on a larger drive.
What port and address does Ollama use?
The server binds to 127.0.0.1:11434 by default and its native API is at http://localhost:11434/api. Change the bind address with the OLLAMA_HOST environment variable. OpenAI-compatible clients can use http://localhost:11434/v1/ with a placeholder API key such as ollama.
Sources
- Ollama CLI reference: run, pull, ls, ps, stop, rm, launch, Ollama (GitHub docs). Accessed October 6, 2026.
- Ollama FAQ: context window, keep-alive, concurrency, Flash Attention, K/V cache quantization, multiple GPUs and GPU check, Ollama. Accessed October 10, 2026.
- Ollama: context length defaults and settings, Ollama. Accessed October 6, 2026.
- Ollama API introduction: local base URL and chat endpoint, Ollama. Accessed October 6, 2026.
- Ollama: OpenAI compatibility, Ollama. Accessed October 6, 2026.
- Ollama: Anthropic compatibility, Ollama. Accessed October 6, 2026.
Spotted an error or an outdated price? Tell us and we will fix it.
Change history
- : First published from Ollama's CLI reference, FAQ and API documentation.
Next review: .
Part of our Local Models & Hardware guide.
Keep reading
- How to run an LLM locally on Windows, Mac or Linux
Install Ollama, pick a model that fits your memory, chat with it, check it runs on the GPU and connect other apps, with the official commands for each OS.
- Ollama vs LM Studio: which one should you use?
Ollama or LM Studio for running LLMs locally? Compare license terms, platforms, interface, local APIs and server use, from each project's own docs.
- How much VRAM do you need to run an LLM locally?
Work out how much GPU memory a local LLM needs from its size, quantization and context length. Our formula is checked against 13 real model files.
- What is a context window in a language model?
What a context window is, how big it is for Claude, GPT and Gemini in 2026, what happens when it fills up, why bigger is not always better and what it costs.
- What is RAG (retrieval-augmented generation)?
What RAG (retrieval-augmented generation) is, how it works step by step, when to use it instead of pasting everything into a prompt and how to improve it.
Other topics

Assistants & Chatbots
16 guides

LLM APIs & Costs
11 guides

Agents & Automation
8 guides

Language Models Explained
14 guides