Ollama commands

Ollama commands for release 0.35.1, taken from the built-in help, the official documentation and the source of the interactive prompt: subcommands and flags, the slash commands and editing keys used inside ollama run MODEL, server environment variables, Modelfile instructions and the main REST endpoints. Arguments in capitals such as MODEL, PROMPT or INT stand for your own value; Modelfile keywords and variable names are typed as shown. Slash commands and key bindings work only at the interactive prompt.

141 commands in 10 sections. Checked row by row against Ollama documentation: CLI Reference (docs/cli.mdx, release v0.35.1) on . Edited by Jay.

Model management 16

Model names follow the model:tag format. The tag is optional; when it is left out, latest is used.

CommandWhat it does
ollama pull MODELDownload modelFetches the model from a registry so it can be run locally.
ollama pull gemma4:e2bPull specific versionThe part after the colon is the tag; without one, the tag named latest is pulled.
ollama listList local modelsShows every model already downloaded to this machine.
ollama lsList models (short form)Alias of ollama list that prints the same local models.
ollama show MODELModel infoPrints a summary of one model; add a flag to print a single section instead.
ollama show MODEL --modelfilePrint the ModelfileOutputs the model's Modelfile, a starting point for building a variant of it.
ollama show MODEL --parametersPrint model parameters
ollama show MODEL --templatePrint prompt template
ollama show MODEL --systemPrint system message
ollama show MODEL --licensePrint model license
ollama show MODEL -vShow detailed model infoVerbose form that prints more than the default summary; --verbose is the long spelling.
ollama cp SOURCE DESTINATIONCopy modelDuplicate a model under a new name.
ollama rm MODELRemove modelDeletes the downloaded model; several names can be given in one command.
ollama push MODELPublish modelUploads a local model to a registry.
ollama signinSign in to ollama.comConnects this machine to your account, which pushing models and pulling private ones require.
ollama signoutSign out of ollama.com

Running models 13

CommandWhat it does
ollama run MODELRun interactiveDownloads the model if needed, then opens a chat in the terminal.
ollama run MODEL PROMPTSingle promptAnswers the prompt given on the command line and exits instead of opening a chat.
echo "Hello world" | ollama run nomic-embed-textPipe inputText piped on standard input becomes the prompt; an embedding model prints its vector as JSON.
ollama run embeddinggemma "Hello world"Generate embeddingsWith an embedding model the text is turned into a vector instead of a chat reply.
ollama run MODEL ""Preload a modelAn empty prompt loads the model into memory so the next request starts faster.
ollama run MODEL --verboseShow response timingsPrints timing statistics after each answer.
ollama run MODEL --format jsonRequest JSON outputSets the response format for the whole session, like /set format json at the prompt.
ollama run MODEL --keepalive 5mSet keep-alive timeKeeps the model in memory for the given duration after the last request.
ollama run MODEL --thinkEnable thinking modeFor models that support it; --think=false turns it off and --think=high, medium or low sets a level.
ollama run MODEL --hidethinkingHide thinking outputLeaves the reasoning text out and prints only the final answer.
ollama run MODEL --nowordwrapTurn off word wrapStops long lines from being broken onto the following line.
ollama psList running modelsShows which models are in memory and whether each sits on the GPU, the CPU or both.
ollama stop MODELStop a running modelUnloads the model right away instead of waiting for the keep-alive time to pass.

Launching integrations 6

CommandWhat it does
ollama launchOpen the integration menuLets you pick a supported coding tool and sets it up to use Ollama models.
ollama launch claudeLaunch Claude CodeStarts the named integration directly; opencode, codex, droid and vscode work the same way.
ollama launch claude --model MODELLaunch with a chosen modelSkips the interactive model picker and uses the model named here.
ollama launch droid --configConfigure without launchingWrites the integration's settings but does not start the app.
ollama launch codex --restoreRestore default profile
ollama launch codex -- --sandbox workspace-writePass extra argumentsEverything after the double dash is handed to the integration itself.

Interactive session 13

CommandWhat it does
/?Show session helpLists the slash commands of the session; /help does the same.
/? shortcutsList keyboard shortcutsPrints the line-editing keys that work at the prompt.
/show infoModel detailsShows details of the model loaded in this session.
/show modelfileShow ModelfilePrints the Modelfile of the model you are chatting with.
/show parametersShow parameters
/show systemShow system message
/show templateShow prompt template
/show licenseShow model license
/load MODELSwitch to another modelSwitches the session to another model, or to one saved earlier with /save.
/save MODELSave session as a modelCreates a new model under the given name from the session as it stands.
/clearClear historyEmpties the conversation context; a system message that was set stays in place.
/byeExit chatEnds the session and returns to the shell; /exit works too.
"""Start a multi-line messageOpen and close the text with triple quotes to type a prompt over several lines.

Session settings 22

CommandWhat it does
/set system STRINGSet system promptReplaces the system message used for the rest of the session.
/set parameter num_ctx INTSet context sizeChanges the context window, in tokens, for this session.
/set parameter temperature FLOATSet temperatureHigher values make the answers more creative.
/set parameter seed INTSet random seedA fixed seed makes the model give the same text for the same prompt.
/set parameter num_predict INTLimit generated tokensCaps how many tokens one answer may contain.
/set parameter top_k INTSet top-k samplingRestricts sampling to the k most likely tokens.
/set parameter top_p FLOATSet top-p samplingChooses tokens by cumulative probability; lower values give more focused text.
/set parameter min_p FLOATSet min-p thresholdDrops tokens whose probability falls below this fraction of the most likely token's.
/set parameter repeat_penalty FLOATSet repetition penaltyHigher values discourage repeated text more firmly.
/set parameter repeat_last_n INTSet repetition lookbackSets how many recent tokens are checked for repeats.
/set parameter num_gpu INTSet GPU layer countChooses how many model layers are offloaded to the graphics card.
/set parameter stop STRING ...Set stop sequencesGeneration ends as soon as the model produces one of these strings.
/set format jsonEnable JSON modeAsks for JSON answers until /set noformat is entered.
/set noformatTurn off output format
/set verboseShow response statisticsPrints response statistics after every answer, like the --verbose flag of ollama run.
/set quietHide response statistics
/set thinkEnable thinking
/set nothinkDisable thinking
/set wordwrapEnable word wrap
/set nowordwrapDisable word wrap
/set historyEnable prompt history
/set nohistoryDisable prompt historyTyped prompts are no longer added to the recall history.

Prompt editing keys 11

CommandWhat it does
Ctrl+AMove to line start
Ctrl+EMove to line end
Alt+BMove back one word
Alt+FMove forward one word
Ctrl+KDelete text after cursor
Ctrl+UDelete text before cursor
Ctrl+WDelete previous word
Ctrl+LClear the screen
Ctrl+GCompose prompt in editorOpens the default editor, or the one named in OLLAMA_EDITOR, for writing a long prompt.
Ctrl+CStop the responseInterrupts the model while it is still generating an answer.
Ctrl+DExit the sessionLeaves ollama run, the same as typing /bye.

Server and setup 10

CommandWhat it does
ollama serveStart serverStarts the API server, bound to 127.0.0.1 port 11434 unless OLLAMA_HOST is set.
ollama serve --helpList server variablesPrints the environment variables the server reads, each with a short description.
ollama -vShow versionPrints the installed version; --version is the long spelling.
ollama COMMAND --helpHelp for a commandAdd --help after any subcommand to see its flags and variables.
OLLAMA_CONTEXT_LENGTH=8192 ollama serveStart with a larger contextStarts the server with an 8K default context window for this run only.
launchctl setenv OLLAMA_HOST "0.0.0.0:11434"Set a variable on macOSFor the macOS app: sets the variable through launchctl; restart Ollama to apply it.
systemctl edit ollama.serviceEdit the Linux serviceOpens an override file where Environment lines for the systemd service are added.
Environment="OLLAMA_HOST=0.0.0.0:11434"Expose server (systemd line)Placed under [Service], it makes the server listen on every network interface.
systemctl restart ollamaRestart the Linux serviceRun systemctl daemon-reload first so the edited unit is picked up.
curl -fsSL https://ollama.com/install.sh | shInstall or update on LinuxRunning the script again upgrades an existing Linux installation.

Environment variables 22

Where to set them depends on the install: launchctl setenv for the macOS app, an Environment line in the systemd service on Linux, user environment variables on Windows. Restart Ollama afterwards.

CommandWhat it does
OLLAMA_HOSTServer addressAddress and port the server binds to and the client connects to; 127.0.0.1:11434 by default.
OLLAMA_MODELSCustom model dirStores model files in this directory instead of the default location.
OLLAMA_CONTEXT_LENGTHDefault context lengthUsed for any request that does not set a context length of its own.
OLLAMA_KEEP_ALIVEDefault keep-alive timeHow long a model stays in memory after a request; 5 minutes unless changed.
OLLAMA_NUM_PARALLELParallel requestsMost requests one model handles at the same time; memory use grows with the value.
OLLAMA_MAX_LOADED_MODELSMax loaded modelsLimits how many models stay loaded at once, counted per GPU.
OLLAMA_MAX_QUEUERequest queue limitRequests beyond this number are rejected with a 503 while the server is busy.
OLLAMA_ORIGINSAllowed web originsComma-separated origins that may call the API from a browser.
OLLAMA_DEBUGDebug loggingSet it to 1 for more detailed log output.
OLLAMA_NO_CLOUDDisable cloud featuresSet it to 1 to turn off cloud models and web search.
OLLAMA_FLASH_ATTENTIONFlash Attention switchSet 1 to force Flash Attention on or 0 to turn it off.
OLLAMA_KV_CACHE_TYPEK/V cache quantizationAccepts f16, q8_0 or q4_0; lower precision uses less memory.
OLLAMA_NOPRUNEKeep unused blobsSkips the cleanup of model blobs that normally runs when the server starts.
OLLAMA_SCHED_SPREADSpread across all GPUsSplits a model over every GPU even when it would fit on a single one.
OLLAMA_GPU_OVERHEADReserve VRAM per GPUAmount of video memory, in bytes, left unused on each graphics card.
OLLAMA_IGPU_ENABLEUse integrated GPUs
OLLAMA_LLM_LIBRARYForce an LLM libraryNames the library to load instead of letting Ollama detect one.
OLLAMA_LOAD_TIMEOUTModel load timeoutA load that stalls longer than this is abandoned; 5 minutes unless changed.
OLLAMA_MAX_TRANSFER_STREAMSParallel transfer streamsApplies to pulling and pushing safetensors models; 4 streams unless changed.
OLLAMA_EDITORPrompt editor pathRead by ollama run: the editor that Ctrl + G opens in an interactive session.
OLLAMA_NOHISTORYNo saved prompt historyRead by ollama run: typed prompts are not kept between sessions.
HTTPS_PROXYProxy for model downloadsRoutes model pulls through a proxy; leave HTTP_PROXY unset, since it can break client connections.

Modelfile 16

Instruction names are not case sensitive and can come in any order; capitals and FROM-first are conventions of the examples.

PARAMETER also takes seed, top_k, top_p, min_p, num_predict, repeat_penalty and repeat_last_n, the same names /set parameter uses in a session.

CommandWhat it does
FROM MODELBase modelRequired instruction naming the existing model to build on.
FROM ./ollama-model.ggufBuild from a GGUF fileThe path is absolute or relative to the Modelfile's location.
FROM DIRECTORYBuild from Safetensors weightsPoints at a folder holding Safetensors weights for a supported architecture.
SYSTEM """You are a happy cat."""System promptSets the system message the model starts every conversation with.
PARAMETER temperature 1TemperatureHigher values give more creative answers, lower ones more coherent; the default is 0.8.
PARAMETER num_ctx 4096Context lengthSets how many tokens the model can use as context when generating.
PARAMETER stop "<|eot_id|>"Stop sequenceGeneration stops when this text appears; repeat the line to set several.
TEMPLATEPrompt templateFollowed by the full prompt in Go template syntax, usually inside triple quotes.
{{ .System }}System message variableTemplate placeholder that is replaced by the system message.
{{ .Prompt }}User prompt variableTemplate placeholder that is replaced by the user's message.
{{ .Response }}Model response variableMarks where the answer goes; text after it is left out while generating.
MESSAGE user Is Toronto in Canada?Add an example user turnBuilds a message history; the role can be system, user or assistant.
MESSAGE assistant yesAdd an example replyPaired with a user line, it shows the model how to answer similar questions.
REQUIRES VERSIONMinimum Ollama versionStates the oldest Ollama release the model works with, for example 0.14.0.
ollama create MODEL -f ModelfileBuild modelCreates a named local model from the instructions in that file.
ollama create MODELBuild from the default fileWithout -f, the file named Modelfile in the current directory is used.

API endpoints 12

CommandWhat it does
POST /api/generateGenerate APIReturns a completion for one prompt as a stream of JSON objects.
POST /api/chatChat APITakes the message history and returns the next message, streamed unless stream is false.
POST /api/embedEmbeddings APIReturns embedding vectors for the input text.
POST /api/showModel details APIReturns a model's Modelfile, template, parameters, license and system prompt.
POST /api/pullPull model APIDownloads a model; a cancelled pull continues from where it stopped.
DELETE /api/deleteDelete model APIRemoves a model together with its data from the server.
curl http://localhost:11434/api/tagsList models APIReturns the locally available models as JSON.
curl http://localhost:11434/api/psRunning models APIReturns the models that are in memory right now.
curl http://localhost:11434/api/versionVersion APIReturns the version number of the running server.
curl http://localhost:11434/api/generate -d '{"model": "mistral"}'Preload a model via APIA request without a prompt only loads the model into memory.
curl http://localhost:11434/api/generate -d '{"model": "llama3.2", "keep_alive": -1}'Keep a model loadedA negative keep_alive value leaves the model in memory indefinitely.
curl http://localhost:11434/api/generate -d '{"model": "llama3.2", "keep_alive": 0}'Unload a model via APIA keep_alive of 0 frees the memory as soon as the request is answered.

Notes

The pull–run loop

Day-to-day Ollama is three commands: ollama pull MODEL downloads, ollama run MODEL opens an interactive chat, and ollama list shows what is on disk (ollama rm MODEL reclaims the space — local models are gigabytes each). Tags select variants: ollama pull gemma4:e2b asks for one specific tag instead of the default, latest. For scripting, pass the prompt inline with ollama run MODEL PROMPT or pipe text straight in, as in echo "Hello world" | ollama run nomic-embed-text. ollama ps shows what is loaded in memory and ollama stop MODEL unloads it.

Inside an interactive session, slash-commands control the chat: /clear wipes context, /set system STRING changes the system prompt on the fly, /show info and /show modelfile reveal what you are actually running, and /bye exits. /? shortcuts prints the editing keys, such as Ctrl + A and Ctrl + E for the ends of the line.

Serving and shaping models

ollama serve runs the API server that everything talks to on port 11434 — POST /api/generate and POST /api/chat are the two endpoints most integrations use. Environment variables tune it: OLLAMA_MODELS relocates the model store to a bigger drive, OLLAMA_NUM_PARALLEL sets how many requests a model handles at once, and OLLAMA_HOST changes the address the server binds to. ollama serve --help lists them all. To make a customised assistant permanent, write a Modelfile — FROM MODEL, a SYSTEM """You are a happy cat.""" line for the system prompt, PARAMETER temperature 1 and PARAMETER num_ctx 4096 — then build it once with ollama create MODEL -f Modelfile and run it by name from then on.

Questions

What do the tags after the colon mean?

Variants of the same model, typically parameter sizes and quantisation levels. Pulling without a tag gets the one tagged latest; ollama pull gemma4:e2b asks for an exact one. ollama show MODEL reports what a downloaded copy actually is — worth checking before comparing quality or speed.

Is OLLAMA_HOST=0.0.0.0 safe?

Treat it carefully. By default the server binds to 127.0.0.1, and the local API asks for no authentication; setting OLLAMA_HOST to 0.0.0.0 binds it to every network interface, so anyone who can reach the port can run your models. Fine on a trusted LAN; behind anything less, keep the default localhost binding or put a reverse proxy with auth in front.

Where do the models live, and can I move them?

By default in ~/.ollama/models on macOS, /usr/share/ollama/.ollama/models on Linux and C:\Users\%username%\.ollama\models on Windows. Set OLLAMA_MODELS for the server process to store them elsewhere — a common fix when the system drive is small, since a handful of models easily consumes tens of gigabytes. On Linux with the standard installer, the ollama user needs read and write access to the new directory.

Do I need to run ollama serve myself?

Usually not on a desktop install, where opening the app starts the server and ollama run MODEL just works. Run ollama serve manually on Linux when the server is not already running, in containers, or whenever you want to control the environment variables the server starts with.

How do I make a custom assistant I can reuse?

Write a Modelfile: FROM MODEL for the base, a SYSTEM line for standing instructions, PARAMETER lines for behaviour. Then ollama create MODEL -f Modelfile builds it as a named local model — your settings persist without repeating /set system STRING every session.

Sources and checks

Every row on this page was matched to a line in the documentation above on . A binding that could not be found there is not listed.

1 row from the earlier version of this page was removed in that check: duplicates, and bindings the documentation does not list or lists differently.

Found a wrong or missing key? Tell us and it gets checked against the source. How we verify describes the process and its limits.