Back to Article List

Ollama commands: CLI cheat sheet with examples

Ollama commands: CLI cheat sheet with examples

The Ollama CLI is small enough to learn in an afternoon and busy enough that nobody remembers all of it. This page covers every command you'll touch in a normal week, each with a working example, plus the answers people search for: how to stop ollama serve, where models live on disk and how to check the server is up. Everything below is checked against the v0.32 line (August 2026). If you haven't installed Ollama yet, the install Ollama on Ubuntu guide gets you to a working setup first.

Running models

Run a model with ollama run

The command you'll type most. It loads the model (downloading it first if needed) and drops you into an interactive chat:

ollama run llama3.1

Pass a prompt as an argument for a one-shot answer instead of a session. Handy in scripts:

ollama run llama3.1 "Write a haiku about disk space"

The flag I use constantly is --verbose, which prints timing stats after each response, including tokens per second. It's the fastest way to benchmark a model on new hardware:

ollama run llama3.1 --verbose "Count to ten"

Other flags worth knowing: --format json forces JSON output, --keepalive 10m keeps the model loaded for ten minutes after you exit and --think or --hidethinking control the visible reasoning of models like deepseek-r1. There's also ollama launch, which wires coding tools such as Claude Code into your local models, though that's a separate topic.

Stop a model with ollama stop

This unloads a model from RAM or VRAM without touching the server:

ollama stop llama3.1

You rarely need it. Models unload themselves five minutes after the last request. Reach for it when you want the memory back immediately, say before loading a bigger model on a machine that can't hold both.

Interactive session commands

Inside a ollama run session, lines starting with / are commands instead of prompts. The ones that earn their place:

/set parameter num_ctx 16384
/set system "You are a terse code reviewer"
/set verbose
/show info
/show modelfile
/save my-session
/load my-session
/clear
/bye

/set parameter changes sampling settings for the current session, including num_ctx, temperature, top_k, top_p and seed. The num_ctx one matters most in practice, and the Ollama context window guide explains why the 4096 default bites people. /clear wipes the conversation history without restarting, /bye exits (Ctrl+D works too) and /? shortcuts lists the keyboard shortcuts. For multi-line prompts, wrap the text in triple quotes: """ starts the block and another """ ends it.

Managing models

Download a model with ollama pull

Pull fetches a model without running it, which is what you want on a server where you're staging things ahead of time:

ollama pull deepseek-r1:14b

That tag is a 9.0GB download, so on a slow link it takes a while. Running pull again on a tag you already have checks for updates and fetches only changed layers. Browse tags and sizes on the Ollama model library before you commit the bandwidth. One quirk to know: pulls happen over HTTPS only, so if you're behind a proxy, set HTTPS_PROXY. Setting HTTP_PROXY does nothing for pulls.

List installed models with ollama list

ollama list

This prints every model on disk with its ID, size and modification date. ollama ls is the same command. This answers "ollama list models" but note it shows what's installed, and says nothing about what's loaded in memory. That's ollama ps, covered below.

Delete a model with ollama rm

Searching for "ollama delete model" or "ollama remove model" lands here: the command is rm:

ollama rm deepseek-r1:14b

Disk space comes back immediately. Models share storage layers where they can, so removing one variant of a family sometimes frees less than the listed size, because a sibling tag still references the shared blobs.

Inspect a model with ollama show

Show prints a model's architecture, parameter count, quantization and context length:

ollama show llama3.1

The flags are where it gets useful: --modelfile prints the full Modelfile (great as a starting point for your own), and --parameters, --system and --template print those sections alone. I run ollama show --modelfile on any model before customizing it, because the template section explains a lot of odd behavior.

Copy a model with ollama cp

ollama cp llama3.1 llama3.1-backup

Copy gives an existing model a second name. It's cheap (layers are shared, not duplicated) and it's the sane way to experiment: copy first, break the copy.

Build a custom model with ollama create

Create builds a model from a Modelfile, which is a small text file naming a base model and your overrides:

ollama create support-bot -f ./Modelfile

A Modelfile holds a FROM line plus optional PARAMETER and SYSTEM lines. Baking parameters in this way beats retyping /set commands every session.

Publish a model with ollama push

Push uploads a model to the ollama.com registry under your namespace. Sign in first with ollama signin, then:

ollama cp support-bot your-username/support-bot
ollama push your-username/support-bot

Most people never push anything, and that's fine. It exists for sharing custom builds across machines or with a team.

Server and status

Start the server with ollama serve

ollama serve

This starts the API server in the foreground on 127.0.0.1:11434. On Linux you almost never run it by hand, because the installer registers a systemd service that starts at boot. The distinction matters for configuration: environment variables like OLLAMA_HOST belong in the systemd unit rather than your shell, or the service won't see them. The Ollama VPS hosting guide walks through the systemd override and reverse proxy setup for remote access.

Check loaded models with ollama ps

ollama ps

Where list shows disk, ps shows memory: which models are loaded right now, how much RAM or VRAM each occupies, the CPU/GPU split and when each will unload. If a model shows something like "48%/52% CPU/GPU", it didn't fit in VRAM and is running partly on the CPU, which explains sudden slowness better than any log line.

How to stop ollama serve

Depends on how it's running. For the systemd service on Linux:

sudo systemctl stop ollama

Add sudo systemctl disable ollama if it shouldn't come back at boot. If you launched ollama serve in a terminal yourself, Ctrl+C ends it. And if a stray process is still holding port 11434 (it happens after a crashed session), find it and kill it:

sudo lsof -i :11434
sudo kill <PID>

Remember that stopping a model and stopping the server are different things. ollama stop llama3.1 frees memory while the API stays up. systemctl stop ollama takes the whole API down.

Check Ollama status

There's no dedicated status subcommand, so people asking for an "ollama status command" want one of these three. Check the service:

systemctl status ollama

Check the API responds:

curl http://localhost:11434

A healthy server answers with the plain text "Ollama is running". curl http://localhost:11434/api/version returns the version as JSON if you need it in a script. Then ollama ps tells you what's loaded. Between those three you can tell a dead service from a running-but-idle one in seconds.

Where Ollama stores models

On Linux with the service install, models live in /usr/share/ollama/.ollama/models. If you run ollama serve as your own user instead, they land in ~/.ollama/models. macOS and Windows use the home directory equivalent. This is why a model pulled under your user account sometimes seems to vanish when the service handles the next request: two processes, two stores.

Move the model directory with OLLAMA_MODELS

Models are multi-gigabyte files, so a small root partition fills fast. Point Ollama at a bigger disk with the OLLAMA_MODELS variable. Stop the service, move the data, then set the override:

sudo systemctl stop ollama
sudo mkdir -p /data/ollama-models
sudo rsync -a /usr/share/ollama/.ollama/models/ /data/ollama-models/
sudo chown -R ollama:ollama /data/ollama-models
sudo systemctl edit ollama

In the editor, add:

[Service]
Environment="OLLAMA_MODELS=/data/ollama-models"

Then reload and restart:

sudo systemctl daemon-reload
sudo systemctl start ollama
ollama list

The chown line is the step everyone skips. The service runs as the ollama user, and without read-write access to the new path, every pull fails with a permissions error. The official FAQ covers this and the other environment variables in one place. If you'd rather not manage any of this by hand, the Ollama VPS template deploys Ollama together with Open WebUI in one click on NVMe storage, with the service already configured.

Troubleshooting notes

When a command misbehaves, the server log is the first stop: journalctl -e -u ollama shows the most recent entries. For deeper digging, set OLLAMA_DEBUG=1 in the systemd override and restart. A pull that fails with a 404 usually means a typo in the tag, so check the exact spelling on the library page. Slow generation right after a hardware change is worth a ollama ps to confirm the model still fits in VRAM. For error messages beyond that, the Ollama troubleshooting guide collects the common failures and their fixes. Reference: the official CLI docs track new commands as they land.

Questions?

Can I run two models at the same time?

Yes. The server keeps up to OLLAMA_MAX_LOADED_MODELS models in memory at once (default 3 on CPU or 3 per GPU), and OLLAMA_NUM_PARALLEL controls concurrent requests per model. Both are set as Environment= lines in the systemd override. Memory is the real limit: two 8B models need roughly the combined RAM of both.

Race towards the future

Unrivaled speed meets competitive pricing

Ready in seconds 7-day money-back guaranteeA risk-free way to try LumaDock. Covers the GPU VPS plan on your first order. Cancel anytime
Betalingscyclus

GPU.T4

£116.64 Save  19 %
£94.63 Maandelijks
  • Dedicated GPU
  • Tesla T4

  • 16 GB GDDR6vRAM
  • 2560CUDA CORES
  • Virtuele server
  • 8 vCPUAMD EPYC
  • 32 GBECC-GEHEUGEN
  • 250 GB NVMeOPSLAG
  • Ongelimiteerde bandbreedte
  • IPv4 & IPv6 inbegrepen IPv6-ondersteuning is momenteel niet beschikbaar in Frankrijk, Finland of Nederland.

GPU.ADA4000SFF

£219.30 Save  17 %
£182.63 Maandelijks
  • Dedicated GPU
  • RTX 4000 SFF Ada

  • 20 GB GDDR6 ECCvRAM
  • 6144CUDA CORES
  • Virtuele server
  • 16 vCPUAMD EPYC
  • 64 GBECC-GEHEUGEN
  • 350 GB NVMeOPSLAG
  • Ongelimiteerde bandbreedte
  • IPv4 & IPv6 inbegrepen IPv6-ondersteuning is momenteel niet beschikbaar in Frankrijk, Finland of Nederland.

GPU.PRO4000SFF

£263.31 Save  17 %
£219.30 Maandelijks
  • Dedicated GPU
  • RTX PRO 4000 Blackwell

  • 24 GB GDDR7 ECCvRAM
  • 8960CUDA CORES
  • Virtuele server
  • 16 vCPUAMD EPYC
  • 64 GBECC-GEHEUGEN
  • 400 GB NVMeOPSLAG
  • Ongelimiteerde bandbreedte
  • IPv4 & IPv6 inbegrepen IPv6-ondersteuning is momenteel niet beschikbaar in Frankrijk, Finland of Nederland.

GPU.PRO4500

£373.33 Save  20 %
£299.98 Maandelijks
  • Dedicated GPU
  • RTX PRO 4500 Blackwell

  • 32 GB GDDR7 ECCvRAM
  • 10496CUDA CORES
  • Virtual Server
  • 16 vCPUAMD EPYC
  • 64 GBECC MEMORY
  • 450 GB NVMeSTORAGE
  • Unmetered bandwidth
  • IPv4 & IPv6IPv6 is currently unavailable in France, Finland or the Netherlands. included

GPU.PRO5000

£512.68 Save  20 %
£410.00 Maandelijks
  • Dedicated GPU
  • RTX PRO 5000 Blackwell

  • 48 GB GDDR7 ECCvRAM
  • 14080CUDA CORES
  • Virtual Server
  • 32 vCPUAMD EPYC
  • 96 GBECC MEMORY
  • 500 GB NVMeSTORAGE
  • Unmetered bandwidth
  • IPv4 & IPv6IPv6 is currently unavailable in France, Finland or the Netherlands. included

GPU.PRO6000

£879.41 Save  19 %
£710.71 Maandelijks
  • Dedicated GPU
  • RTX PRO 6000 Blackwell

  • 96 GB GDDR7 ECCvRAM
  • 24064CUDA CORES
  • Virtual Server
  • 32 vCPUAMD EPYC
  • 128 GBECC MEMORY
  • 650 GB NVMeSTORAGE
  • Unmetered bandwidth
  • IPv4 & IPv6IPv6 is currently unavailable in France, Finland or the Netherlands. included

*VAT excluded.

INCLUDED WITH EVERY PLAN

No setup fees 1 Gbps network
Free server monitoring Firewall management 24/7 support KVM virtualization