[GH-ISSUE #5380] Ollama Run provides numerical choice to run one of models from list #49874

Closed
opened 2026-04-28 13:15:58 -05:00 by GiteaMirror · 3 comments
Owner

Originally created by @rayking99 on GitHub (Jun 29, 2024).
Original GitHub issue: https://github.com/ollama/ollama/issues/5380

Hi,

I think it would be cool if ollama run without any extra arguments showed the models in ollama list, but with a number next to them.

Ie ollama run ->

TYPE NUMBER OF MODEL TO RUN
[0] gemma2:27b-instruct-q8_0
[1] qwen2:0.5b
[2] mistral:7b-instruct-v0.3-q8_0
[3] gemma:2b-instruct
[4] phi3:3.8b-mini-instruct-4k-fp16
[5] llama3:8b-instruct-fp16
[6] llama3:70b-instruct-q8_0

My workflow is always ollama list -> ollama run model-i-copy-pasted

Apologies if this has already been requested or if it isn't in the vision. Running in the shell is great, this would be a nice touch.

Originally created by @rayking99 on GitHub (Jun 29, 2024). Original GitHub issue: https://github.com/ollama/ollama/issues/5380 Hi, I think it would be cool if ollama run without any extra arguments showed the models in ollama list, but with a number next to them. Ie ollama run -> ```sh TYPE NUMBER OF MODEL TO RUN [0] gemma2:27b-instruct-q8_0 [1] qwen2:0.5b [2] mistral:7b-instruct-v0.3-q8_0 [3] gemma:2b-instruct [4] phi3:3.8b-mini-instruct-4k-fp16 [5] llama3:8b-instruct-fp16 [6] llama3:70b-instruct-q8_0 ``` My workflow is always ollama list -> ollama run model-i-copy-pasted Apologies if this has already been requested or if it isn't in the vision. Running in the shell is great, this would be a nice touch.
GiteaMirror added the feature request label 2026-04-28 13:15:58 -05:00
Author
Owner

@rick-github commented on GitHub (Jun 29, 2024):

#!/bin/bash

OLLAMA_HOST=${OLLAMA_HOST:-localhost:11434}

list=($(curl -s $OLLAMA_HOST/api/tags | jq -r '.models[].name'))

i=0; for m in ${list[*]} ; do printf "[%2d] $m\n" $[i++] ; done

while
  read -p 'Select model: ' MODEL || { echo ; exit 0 ; }
  ! _=$(expr match "$MODEL" "[0-9][0-9]*$") || [ "$MODEL" -ge ${#list[*]} ]
  do
    :
done

ollama run ${list[$MODEL]}
<!-- gh-comment-id:2198365573 --> @rick-github commented on GitHub (Jun 29, 2024): ``` #!/bin/bash OLLAMA_HOST=${OLLAMA_HOST:-localhost:11434} list=($(curl -s $OLLAMA_HOST/api/tags | jq -r '.models[].name')) i=0; for m in ${list[*]} ; do printf "[%2d] $m\n" $[i++] ; done while read -p 'Select model: ' MODEL || { echo ; exit 0 ; } ! _=$(expr match "$MODEL" "[0-9][0-9]*$") || [ "$MODEL" -ge ${#list[*]} ] do : done ollama run ${list[$MODEL]} ```
Author
Owner

@rayking99 commented on GitHub (Jun 29, 2024):

NIce, thanks

<!-- gh-comment-id:2198370351 --> @rayking99 commented on GitHub (Jun 29, 2024): NIce, thanks
Author
Owner

@jmorganca commented on GitHub (Jun 29, 2024):

@rick-github cool! Thanks for sharing

<!-- gh-comment-id:2198370735 --> @jmorganca commented on GitHub (Jun 29, 2024): @rick-github cool! Thanks for sharing
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/ollama#49874