Plenty of Ollama commands cheat sheets online started life in 2024 and got patched later. Some of them show it. A few skip ollama launch, others miss the newer --think flag, and Ollama’s own docs don’t even agree with each other on the default context size. So we did the boring part. We checked every command and flag below against Ollama’s source code on GitHub and the official docs on 19 November 2026.
One honest note before the list: Ollama isn’t installed on the PC we used for this article, so we didn’t run these commands. Everything here comes from the source and the docs, and we link both so you can check us.
Quick answer: The core Ollama commands are ollama pull (download a model), ollama run (chat with it), ollama ls (list downloaded models), ollama ps (see what’s loaded in memory), ollama stop (unload it) and ollama rm (delete it). They work the same in Windows PowerShell, cmd, macOS Terminal and Linux shells.
- Typing
/byeleaves the chat, but the model stays in memory for 5 minutes by default.ollama stopfrees it right away. - On machines with less than 24 GiB of VRAM, the docs say the default context is only 4k tokens. Coding tools need far more.
ollama psshows two things most people never read: the CONTEXT column and whether the model is on GPU or CPU.- New in 2026:
ollama launchwires Ollama into Claude Code, Codex, OpenCode, VS Code and Droid.
Ollama commands list at a glance
If you only need the names, here they are. This table matches the commands registered in Ollama’s cmd/cmd.go source file and the official CLI reference. Swap gemma4 for whatever model you use.
| Command | What it does | Example |
|---|---|---|
| ollama pull | Download a model | ollama pull gemma4 |
| ollama run | Chat, or send one prompt | ollama run gemma4 |
| ollama ls / list | List downloaded models | ollama ls |
| ollama ps | List models loaded in memory | ollama ps |
| ollama stop | Unload a running model | ollama stop gemma4 |
| ollama rm | Delete one or more models | ollama rm gemma4 |
| ollama show | Model details, license, Modelfile | ollama show gemma4 |
| ollama cp | Copy a model under a new name | ollama cp gemma4 my-gemma |
| ollama create | Build a custom model from a Modelfile | ollama create my-bot -f Modelfile |
| ollama serve | Start the server by hand | ollama serve |
| ollama launch | Hook Ollama into a coding tool | ollama launch claude |
| ollama signin / signout | Log in to ollama.com | ollama signin |
| ollama push | Upload your model to a registry | ollama push you/my-bot |

Two aliases are worth knowing. ollama ls and ollama list are the same command, and ollama serve also answers to ollama start. Run ollama help or add --help to any command for its flags.
Ollama commands for Windows, Mac and Linux: getting started
The commands are identical on all three systems. Only the install step differs. The official one-liners from the Ollama GitHub README are:
# macOS and Linux
curl -fsSL https://ollama.com/install.sh | sh
# Windows (PowerShell)
irm https://ollama.com/install.ps1 | iex
# check it worked
ollama -v
On Windows, the Windows docs say the installer doesn’t need admin rights and adds Ollama to your user PATH, so the ollama command works in PowerShell, cmd or Windows Terminal. It needs Windows 10 22H2 or newer. The desktop app starts the background server for you. You’d only type ollama serve yourself on a headless Linux box, inside Docker, or when you want to watch the server log live.
If you haven’t picked a model or checked whether your laptop can handle one, read our guide on how to run an AI model locally with Ollama or LM Studio first. It covers RAM, VRAM and download sizes. This page assumes Ollama is already installed.
Commands to list, download and delete models
These are the housekeeping commands. You’ll use them more than you expect, because local models are big and disks fill up fast.
ollama pull gemma4 # download (or update) a model
ollama ls # list every model on disk
ollama show gemma4 # size, context length, capabilities
ollama show gemma4 --license # read the license before you ship anything
ollama show gemma4 --modelfile
ollama cp gemma4 gemma4-backup
ollama rm gemma4-backup # delete; rm accepts several names at once
A few things the short cheat sheets leave out. Running ollama pull on a model you already have checks for a newer version, so it doubles as an update command. ollama show takes --license, --modelfile, --parameters, --template and --system, plus -v for the full details. The license flag matters more than people think. Open-weight models come with very different terms, and we break those down in our explainer on open-weight AI models and their licenses.
Want to know where all those gigabytes went? The Ollama FAQ lists the model folders: ~/.ollama/models on macOS, /usr/share/ollama/.ollama/models on Linux and C:\Users\%username%\.ollama\models on Windows. Don’t delete files there by hand. Use ollama rm, which cleans up the shared layers properly.
Ollama run: chat and one-shot prompts
ollama run gemma4 opens a chat at the >>> prompt and downloads the model first if it’s missing. Put a prompt in quotes after the model name and you get one answer back, then the command exits. That’s the form you’ll want in scripts.
# one answer, then exit
ollama run gemma4 "Explain a Python decorator in two sentences"
# feed a file in (bash / zsh)
ollama run gemma4 "Summarize this: $(cat notes.txt)"
# same idea in PowerShell
ollama run gemma4 "Summarize this: $(Get-Content notes.txt -Raw)"
# ask a vision model about an image
ollama run gemma4 "What's in this image? ./screenshot.png"
# save the answer to a file
ollama run gemma4 "Write a .gitignore for a Node project" > .gitignore
The run command has more flags than most guides show. These are the useful ones, taken from the source:
--verboseprints timings after each reply, including tokens per second. It’s the quickest way to compare two models on your own hardware.--format jsonasks for JSON output. Handy when another program reads the answer.--thinkturns thinking on or off for models that support it (true,false, orhigh,medium,low). Add--hidethinkingto keep the reasoning text off your screen.--keepalive 30mkeeps the model loaded longer than the default 5 minutes, which saves the reload wait between prompts.--nowordwrapstops line wrapping, useful when you paste output somewhere else.
Embedding models work through run as well. The CLI docs show ollama run embeddinggemma "Hello world" printing a JSON array of numbers, and piping text in with echo works too.
Slash commands inside a chat
Once you’re at the >>> prompt, regular commands don’t work. You get slash commands instead. Type /? to see them. The full set, from Ollama’s interactive source file:
| Slash command | What it does |
|---|---|
/bye | Leave the chat (Ctrl+D does the same) |
/clear | Wipe the conversation context |
/set system "..." | Change the system message |
/set parameter num_ctx 8192 | Change a parameter for this session |
/set verbose / /set quiet | Show or hide speed stats |
/set format json | Switch to JSON mode |
/set think / /set nothink | Toggle thinking |
/show info | Model details (also license, parameters, template) |
/save my-chat | Save the session as a new model |
/load gemma4 | Switch model or load a saved session |
For long prompts, start and end your message with three double quotes ("""). Ctrl+C stops a reply that’s running away, and Ctrl+G opens your default text editor so you can write the prompt there.
Ollama commands to stop a model and free memory
This is where a lot of people get confused. Leaving the chat doesn’t unload the model. According to the FAQ, models stay in memory for 5 minutes after the last request, so your GPU still looks busy after you’ve typed /bye. Two commands sort it out:
ollama ps # what's loaded, how big, GPU or CPU, context size
ollama stop gemma4 # unload it now
Read the PROCESSOR column in ollama ps. “100% GPU” is what you want. “100% CPU” means the model is running from system RAM, which is much slower. A split like “48%/52% CPU/GPU” means it didn’t fit in VRAM. If you see a split, try a smaller model or a smaller context.
Need the opposite, a model that stays loaded? Use --keepalive on run, or set OLLAMA_KEEP_ALIVE for every model. Through the API, a keep_alive of 0 unloads right after the answer and a negative value keeps the model loaded indefinitely.
The catch nobody puts in a cheat sheet: the default context window is probably smaller than you think. Ollama’s context length docs say machines with under 24 GiB of VRAM get 4k tokens by default, 24 to 48 GiB get 32k, and only 48 GiB or more get 256k. The same page says agents and coding tools should use at least 64,000 tokens. So on a normal laptop, a coding agent connected to Ollama can quietly drop half your file from its context. Check the CONTEXT column in ollama ps, then raise it with OLLAMA_CONTEXT_LENGTH or the slider in the app’s settings. One more oddity: the Modelfile reference still lists num_ctx as 2048, which doesn’t match the context page. Trust what ollama ps reports, not either page.
Ollama create: your own model with a Modelfile
A Modelfile is a short text recipe. It starts from a base model and adds your settings and a system prompt. You aren’t training anything, just saving a preset under a name. The Modelfile reference lists the instructions: FROM (required), PARAMETER, SYSTEM, TEMPLATE, MESSAGE, LICENSE, plus newer ones like REQUIRES.
# file: Modelfile
FROM gemma4
PARAMETER temperature 0.3
PARAMETER num_ctx 16384
SYSTEM You review Python code. Point out bugs first, style last. Keep it short.
# then, in the same folder:
ollama create code-reviewer -f Modelfile
ollama run code-reviewer
Setting num_ctx in the Modelfile fixes the small-context problem for that one model, and you don’t have to touch environment variables. A lower temperature makes the answers steadier, which suits review work. ollama create also takes -q to quantize a safetensors model, but that’s for people importing their own weights.
Environment variables worth knowing
Some behavior can’t be changed with a flag. It’s set with environment variables that the server reads when it starts. ollama serve --help prints the list. These are the ones you’re most likely to touch, with defaults from the FAQ:
| Variable | What it controls | Default |
|---|---|---|
| OLLAMA_HOST | Address and port of the server | 127.0.0.1:11434 |
| OLLAMA_MODELS | Where models are stored | ~/.ollama/models (varies by OS) |
| OLLAMA_KEEP_ALIVE | How long models stay loaded | 5 minutes |
| OLLAMA_CONTEXT_LENGTH | Default context window | 4k / 32k / 256k by VRAM |
| OLLAMA_NUM_PARALLEL | Parallel requests per model | 1 |
| OLLAMA_MAX_LOADED_MODELS | Models loaded at once | 3 per GPU, or 3 on CPU |
| OLLAMA_DEBUG | Extra logging | off |
| OLLAMA_NO_CLOUD | Turn off cloud models and web search | off |
How you set them depends on the system. On Windows, quit Ollama from the tray, add the variable under your user account in the environment variables editor, then start Ollama again. On macOS, the FAQ uses launchctl setenv followed by an app restart. On Linux with systemd, run systemctl edit ollama.service, add the lines under [Service], then reload and restart. Be careful with OLLAMA_HOST=0.0.0.0. It opens the server to your whole network, and the local API doesn’t ask for a password.
Ollama launch and signin: the 2026 additions
ollama launch is the command older cheat sheets don’t have. It sets up a coding tool to use Ollama models. Run it alone for an interactive menu, or name the tool. The CLI page lists OpenCode, Claude Code, Codex, VS Code and Droid as supported.
ollama launch # pick from a menu
ollama launch claude # set up Claude Code
ollama launch claude --model qwen3.5 # choose the model
ollama launch droid --config # configure without starting it
If you’ve never used Claude Code, our Claude Code tutorial for beginners walks through a first project. Just remember the twist above. A local model with a 4k context will feel much weaker inside an agent than the same model in a chat window. And a small local model won’t match the hosted tools we compare in Claude Code vs Codex vs GitHub Copilot. It’s private and free to run, which is a fair trade for some jobs.
ollama signin and ollama signout connect the CLI to an ollama.com account. You need that for cloud models and for ollama push. Purely local use doesn’t need an account at all.
Ollama commands not working? Quick fixes

- “ollama” is not recognized (Windows). Close the terminal and open a new one, since the installer edits your PATH and old windows don’t see it. Still failing? Check that
%LOCALAPPDATA%\Programs\Ollamaexists. - Commands hang or can’t connect. The server isn’t running. Start the Ollama app, or run
ollama servein a separate terminal and leave it open. - A model is painfully slow. Run
ollama ps. If PROCESSOR shows CPU, the model doesn’t fit in VRAM. Pick a smaller size tag. - The model “forgets” earlier parts of a long file. That’s the context window. Raise
num_ctxorOLLAMA_CONTEXT_LENGTH, then confirm inollama ps. - Something else. Read the log. The troubleshooting page puts it at
~/.ollama/logs/server.logon macOS, injournalctl -u ollamaon Linux, and in%LOCALAPPDATA%\Ollamaon Windows.
Our verdict
You can do 90% of your Ollama work with six commands: pull, run, ls, ps, stop and rm. Learn ollama ps properly, because it answers the two questions behind most complaints: is it on the GPU, and how much context did I actually get? After that, write one Modelfile for the job you repeat most. It’s ten seconds of setup that saves you retyping the same system prompt every day.
Skip ollama launch if your laptop has under 16 GB of RAM. Coding agents need big contexts, and small machines can’t give them that. Stick to chat and scripts there.
Next: haven’t picked a model yet? Start with our step-by-step guide to running an AI model on your laptop, then come back here for the commands.
FAQ
How do I list models in Ollama?
Run ollama ls (or ollama list) to see every model on disk with its size and when it was modified. To see only the models loaded in memory right now, run ollama ps.
How do I delete a model in Ollama?
Use ollama rm followed by the model name, for example ollama rm gemma4. You can pass several names in one command. Then run ollama ls to confirm it’s gone.
How do I exit or quit Ollama?
Inside a chat, type /bye or press Ctrl+D. That only closes the chat. To free memory, run ollama stop with the model name. To shut the whole server down, quit the Ollama app from the tray or menu bar, or press Ctrl+C in the terminal running ollama serve.
Can Ollama run terminal commands for me?
Not by itself. ollama run only returns text. To have a local model edit files or run commands, connect it to an agent such as Claude Code or Codex with ollama launch, and review what the agent wants to run before you approve it.