[PR #11540] cmd: add names-only option to list handler. #75871

Open
opened 2026-05-05 08:17:54 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/ollama/ollama/pull/11540
Author: @ruyrocha
Created: 7/26/2025
Status: 🔄 Open

Base: mainHead: feature/list-names-only


📝 Commits (1)

  • af99683 cmd: add names-only option to list handler.

📊 Changes

2 files changed (+77 additions, -1 deletions)

View changed files

📝 cmd/cmd.go (+19 -0)
📝 cmd/cmd_test.go (+58 -1)

📄 Description

This PR introduces names-only to ollama list command, e.g:

 ~/G/ollama (feature/list-names-only)> ./ollama list
NAME                  ID              SIZE      MODIFIED
codellama:7b-code     8df0a30bb1e6    3.8 GB    11 days ago
codegemma:2b          926331004170    1.6 GB    11 days ago
mistral:latest        6577803aa9a0    4.4 GB    11 days ago
qwen3:latest          500a1f067a9f    5.2 GB    11 days ago
qwen2.5vl:latest      5ced39dfa4ba    6.0 GB    11 days ago
gemma3:latest         a2af6cc3eb7f    3.3 GB    11 days ago
deepseek-r1:8b        6995872bfe4c    5.2 GB    11 days ago
deepseek-r1:latest    6995872bfe4c    5.2 GB    11 days ago
 ~/G/ollama (feature/list-names-only)> ./ollama list --help
List models

Usage:
  ollama list [flags]

Aliases:
  list, ls

Flags:
  -h, --help         help for list
      --names-only   Only show model names

Environment Variables:
      OLLAMA_HOST                IP Address for the ollama server (default 127.0.0.1:11434)
 ~/G/ollama (feature/list-names-only)> ./ollama list --names-only
codellama:7b-code
codegemma:2b
mistral:latest
qwen3:latest
qwen2.5vl:latest
gemma3:latest
deepseek-r1:8b
deepseek-r1:latest
 ~/G/ollama (feature/list-names-only)>

Other tools, like docker and podman have a quiet flag to return only the IDs, e.g:

 ~/G/ollama (feature/list-names-only)> podman images
REPOSITORY                 TAG         IMAGE ID      CREATED      SIZE
docker.io/library/mariadb  latest      b5898e2f8654  6 weeks ago  361 MB
 ~/G/ollama (feature/list-names-only)> podman images --quiet
b5898e2f8654
 ~/G/ollama (feature/list-names-only)>

The use case behind this is to get a list of local models, so you can iterate over them without using external tools to get the names only.

Feature request #11541


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/ollama/ollama/pull/11540 **Author:** [@ruyrocha](https://github.com/ruyrocha) **Created:** 7/26/2025 **Status:** 🔄 Open **Base:** `main` ← **Head:** `feature/list-names-only` --- ### 📝 Commits (1) - [`af99683`](https://github.com/ollama/ollama/commit/af996837d23795b0eb5e22d61041ce3c6e8f234d) cmd: add `names-only` option to list handler. ### 📊 Changes **2 files changed** (+77 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `cmd/cmd.go` (+19 -0) 📝 `cmd/cmd_test.go` (+58 -1) </details> ### 📄 Description This PR introduces `names-only` to `ollama list` command, e.g: ``` ~/G/ollama (feature/list-names-only)> ./ollama list NAME ID SIZE MODIFIED codellama:7b-code 8df0a30bb1e6 3.8 GB 11 days ago codegemma:2b 926331004170 1.6 GB 11 days ago mistral:latest 6577803aa9a0 4.4 GB 11 days ago qwen3:latest 500a1f067a9f 5.2 GB 11 days ago qwen2.5vl:latest 5ced39dfa4ba 6.0 GB 11 days ago gemma3:latest a2af6cc3eb7f 3.3 GB 11 days ago deepseek-r1:8b 6995872bfe4c 5.2 GB 11 days ago deepseek-r1:latest 6995872bfe4c 5.2 GB 11 days ago ~/G/ollama (feature/list-names-only)> ./ollama list --help List models Usage: ollama list [flags] Aliases: list, ls Flags: -h, --help help for list --names-only Only show model names Environment Variables: OLLAMA_HOST IP Address for the ollama server (default 127.0.0.1:11434) ~/G/ollama (feature/list-names-only)> ./ollama list --names-only codellama:7b-code codegemma:2b mistral:latest qwen3:latest qwen2.5vl:latest gemma3:latest deepseek-r1:8b deepseek-r1:latest ~/G/ollama (feature/list-names-only)> ``` Other tools, like `docker` and `podman` have a `quiet` flag to return only the IDs, e.g: ```shell ~/G/ollama (feature/list-names-only)> podman images REPOSITORY TAG IMAGE ID CREATED SIZE docker.io/library/mariadb latest b5898e2f8654 6 weeks ago 361 MB ~/G/ollama (feature/list-names-only)> podman images --quiet b5898e2f8654 ~/G/ollama (feature/list-names-only)> ``` The use case behind this is to get a list of local models, so you can iterate over them without using external tools to get the names only. Feature request #11541 --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2026-05-05 08:17:54 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/ollama#75871