$linuxjunkies
>

ollama(1)

Ollama is a command-line tool to run large language models locally on your machine.

UbuntuDebianFedoraArch

Synopsis

ollama [COMMAND] [OPTIONS]

Description

Ollama lets you download, run, and interact with large language models (LLMs) like Llama, Mistral, and others directly on your local machine without requiring cloud services. It provides both a command-line interface and a REST API for programmatic access.

Models are stored locally and run with GPU acceleration when available. You can pull pre-built models from the Ollama library, customize them with Modelfiles, and manage multiple model versions.

Common options

FlagWhat it does
serveStart the Ollama API server (listens on localhost:11434 by default)
run <model>Download and start an interactive chat session with a model
pull <model>Download a model from the registry without running it
push <model>Upload a model to a registry (requires authentication)
listShow all locally installed models and their sizes
rm <model>Delete a model from local storage
show <model>Display model information, parameters, and template details
create -f <file> <name>Build a custom model using a Modelfile
--versionPrint the Ollama version number

Examples

Download and start an interactive chat with the Llama 2 model

ollama run llama2

Download the Mistral model without entering interactive mode

ollama pull mistral

Start the Ollama API server on localhost:11434 for programmatic access

ollama serve

Display all downloaded models with their sizes and last modified time

ollama list

Generate text using the API (requires ollama serve running)

curl http://localhost:11434/api/generate -d '{"model":"llama2","prompt":"Hello"}'

Delete the Llama 2 model from local storage

ollama rm llama2

Create a custom model using a Modelfile and name it 'mycustom'

ollama create -f Modelfile mycustom

Show detailed information about the Mistral model including parameters and template

ollama show mistral

Related commands