Ollama Commands

Ollama offers a variety of command-line tools (CLI) for interacting with locally running models.

To see a list of available commands, you can use:

1
ollama --help

This will display the following:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
Large language model runner

Usage:
ollama [flags]
ollama [command]

Available Commands:
serve Start ollama
create Create a model from a Modelfile
show Show information for a model
run Run a model
stop Stop a running model
pull Pull a model from a registry
push Push a model to a registry
list List models
ps List running models
cp Copy a model
rm Remove a model
help Help about any command

Flags:
-h, --help help for ollama
-v, --version Show version information

Use "ollama [command] --help" for more information about a command.

Basic Usage

  • Run Ollama with flags:
1
ollama [flags]
  • Run a specific command:
1
ollama [command]

Available Commands

  • serve: Start the Ollama service.
  • create: Create a model using a Modelfile.
  • show: Display detailed information about a model.
  • run: Run a model.
  • stop: Stop a running model.
  • pull: Download a model from a registry.
  • push: Upload a model to a registry.
  • list: List all available models.
  • ps: List currently running models.
  • cp: Copy a model.
  • rm: Delete a model.
  • help: Get help for any command.

Flags

  • -h, --help: Show help information for Ollama.
  • -v, --version: Display the version of Ollama.

Model Management

Download a Model

To download a model from the registry:

1
ollama pull <model-name>

Example:

1
ollama pull deepseek-r1:8b

Run a Model

To run a downloaded model:

1
ollama run <model-name>

Example:

1
ollama run deepseek-r1:8b

Stop a Running Model

To stop the running Ollama service:

1
ollama stop <model-name>

Example:

1
ollama stop deepseek-r1:8b

List Local Models

To view all downloaded models:

1
ollama list

Delete a Model

To remove a local model:

1
ollama rm <model-name>

Example:

1
ollama rm deepseek-r1:8b

Custom Models

Create a Custom Model

To create a custom model from an existing one:

1
ollama create <custom-model-name> -f <Modelfile>

Example:

1
ollama create my-model-name -f ./Modelfile

Push a Custom Model

To upload a custom model to the registry:

1
ollama push <model-name>

Example:

1
ollama push my-llama2

Copy a Model

To duplicate an existing model:

1
ollama cp <source-model-name> <new-model-name>

Example:

1
ollama cp llama2 my-llama2-copy

Service Management

Start Ollama Service

To start the Ollama service in the background:

1
ollama serve

Other Common Commands

View Help

To see all available commands:

1
ollama --help

Or

1
ollama -h

Check Version

To check the installed version of Ollama:

1
ollama --version

Or

1
ollama -v

The output looks something like this:

1
ollama version is 0.5.7

Model Information

View Model Details

To see detailed information about a model:

1
ollama show <model-name>

Example:

1
ollama show deepseek-r1:8b

The output is as follows:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
Model
architecture llama
parameters 8.0B
context length 131072
embedding length 4096
quantization Q4_K_M

Parameters
stop "<|begin▁of▁sentence|>"
stop "<|end▁of▁sentence|>"
stop "<|User|>"
stop "<|Assistant|>"

License
MIT License
Copyright (c) 2023 DeepSeek