2026-07-07 05:00:27 Ollama model list with context sizes in Fish
Ollama doesn't list its models with context size, and I wanted to be able to see this info (and model size) all in one go. Fish shell is elegant for tasks like this.

( sh )
  1 #!/usr/bin/env fish
2

3 echo
4 echo "Model Name Context Size"
5 echo
6
7 for model in (ollama list | sort | egrep -v NAME)
8 string replace -ra "\s+" ' ' $model | read -l name x size magnitude x x x
9 set length (ollama show $name | awk '/context length/ { print $3 }')
10
11 printf "%-26s %7.0f %5.1f %2s\n" $name $length $size $magnitude
12 end
13
14 echo


Curiously, and perhaps but a tiny speed bump on the road to the future, ChatGPT, Claude, and my local models, all failed hard, even after many attempts, to know how to properly do line 8, where it takes the $model line and directly assigns its parts to various variable names.

To wit, the above code was completely written without any LLM help. I have yet to see a compelling case for LLM code, but perhaps some day.
Leave a comment