Join our Discord Server

Ollama Cheatsheet [2026 Updated]

A cheat-sheet is a concise summary of important information meant to be used as a quick reference. In the context of Ollama, this cheatsheet covers all commonly used commands for server management, model management, interactive session controls, API usage, custom model creation, and key environment variables — so you can run local LLMs fast without digging through docs.

📋 Table of Contents

🖥️ Server Management

CommandDescription
ollama startStart the Ollama server
ollama serveStart the Ollama server (alias for start)
ollama psCheck if server is running / list running models
ollama ps --verboseCheck server status with system resource details
ollama logsView Ollama server logs
ollama pruneClear the model cache
rm -rf ~/.ollamaFully reset Ollama (removes all data)

Server Management Commands

💡 Tip: On Linux with Ollama installed as a systemd service, use journalctl -u ollama.service to view logs instead of ollama logs. Stop the server with Ctrl+C or by killing the process.


🧰 Model Management

CommandDescription
ollama listList all locally available (pulled) models
ollama pull qwen2.5:0.5bPull / download a model from the Ollama registry
ollama pull mistral:1bPull the Mistral 1B model
ollama pull gemma3:1bPull the Gemma 3 1B model
ollama rm mistral:1bRemove a locally stored model
ollama show gemma3:1bShow model information and metadata
ollama show gemma3:1b --verboseShow detailed model information
ollama cp qwen2.5:0.5b qwen2.5-mydevCopy a model under a new name
ollama run qwen2.5:0.5bRun a model in interactive mode
ollama run qwen2.5:0.5b --streamRun a model with streaming output
ollama generate qwen2.5:0.5b "prompt"Single non-interactive prompt generation
ollama generate qwen2.5:0.5b "prompt" --format jsonGenerate output in JSON format

Model Management Commands

📦 Models: Browse all available models at ollama.com/models. Use the tag suffix (e.g. :1b, :7b) to pull a specific parameter size.


💬 Interactive Session Commands

Once a model is running interactively with ollama run <model>, use the following >>> prompt commands:

Help & Session Control

CommandDescription
>>> /?Show help
>>> /helpShow help (alias)
>>> /clearClear the current session context
>>> /byeExit interactive mode
>>> """multi-line prompt"""Send a multi-line prompt using triple quotes

Session Control

Session Parameters (/set)

CommandDescription
>>> /set parameter seed 13Set random number seed for reproducibility
>>> /set parameter num_predict 100Max number of tokens to predict
>>> /set parameter top_k 3Pick from top K tokens at each step
>>> /set parameter top_p 0.5Pick tokens based on cumulative probability
>>> /set parameter min_p 0.1Discard tokens below this probability threshold
>>> /set parameter num_ctx 1024Set the context window size
>>> /set parameter temperature 0.5Set creativity level (higher = more creative)
>>> /set parameter stop word1 word2Set stop words to end generation
>>> /set system "message"Set the system prompt for the session
>>> /set historyEnable CLI prompt history (Up/Down arrow recall)
>>> /set nohistoryStop recording prompt history
>>> /set format jsonSet output format to JSON
>>> /set noformatRemove output formatting
>>> /set verboseShow LLM generation stats after each response
>>> /set quietDisable LLM stats display

Interactive Session Parameters

Model Info (/show)

CommandDescription
>>> /showShow model information summary
>>> /show infoShow detailed info about the current model
>>> /show licenseShow the model’s license information
>>> /show modelfileShow the Modelfile for the current model
>>> /show parametersShow all parameters set for this model
>>> /show systemShow the system message in use
>>> /show templateShow the prompt template for this model

Model Info Commands


⚙️ Run Parameters

CommandDescription
ollama run gemma3:1b --temperature 0.8Run with higher temperature for more creative output
ollama run gemma3:1b --num-ctx 4096Run with a larger context window (4096 tokens)
ollama run qwen2.5:0.5b --streamRun with streaming token output

Run-time Parameters


🔧 System & Configuration

Command / VariableDescription
ollama versionCheck the installed Ollama version
export OLLAMA_HOST=0.0.0.0:11434Expose Ollama server on all network interfaces
export OLLAMA_MODELS=/path/to/modelsSet a custom directory to store models
curl -fsSL https://ollama.com/install.sh | shUpdate Ollama to the latest version (Linux/macOS)

System & Configuration

💡 Windows: On Windows, Ollama will automatically prompt you to update when a new version is available.


🌐 API Usage via CLI

Ollama exposes a REST API on http://localhost:11434 by default. Use curl to interact with it directly.

Generate (Text Completion)

# Single prompt generation via API
curl -X POST http://localhost:11434/api/generate \
  -H "Content-Type: application/json" \
  -d '{"model": "llama2", "prompt": "Hello world"}'

Chat (Multi-turn)

# Chat with message history
curl http://localhost:11434/api/chat -d '{
  "model": "llama2",
  "messages": [{"role": "user", "content": "Hello"}]
}'

List Models

# List all available models via API
curl http://localhost:11434/api/tags
EndpointDescription
POST /api/generateSingle-turn text generation
POST /api/chatMulti-turn chat with message history
GET /api/tagsList all locally available models
POST /api/pullPull a model via API
DELETE /api/deleteDelete a model via API

Ollama REST API Endpoints


🏗️ Modelfile & Custom Models

A Modelfile lets you create a customised model with your own parameters and system prompt, based on any existing model.

Example Modelfile

# Basic Modelfile — save as ./Modelfile
FROM qwen2.5:0.5b
PARAMETER temperature 0.8
PARAMETER num_ctx 4096
SYSTEM "You are a smart and focused AI Agent."

Modelfile Instructions

InstructionDescription
FROM <model>Base model to build from (required)
PARAMETER temperatureSet the temperature (creativity level)
PARAMETER num_ctxSet the context window size
PARAMETER top_kSet top-K sampling
PARAMETER top_pSet top-P (nucleus) sampling
PARAMETER seedSet random seed for reproducibility
SYSTEM "message"Set the system prompt for the model
TEMPLATEOverride the prompt template
LICENSESpecify the model license

Modelfile Instructions

Create & Use Custom Model

CommandDescription
ollama create myagentmodel -f ./ModelfileCreate a custom model from a Modelfile
ollama run myagentmodelRun your custom model interactively
ollama show myagentmodel --modelfileInspect the Modelfile of a custom model
ollama push myagentmodelPush a custom model to the Ollama registry
ollama rm myagentmodelRemove the custom model
Join our Discord Server