Upgrade all installed Ollama models using command line
When working with a command-line tool like ollama, which manages AI models, it’s often necessary to update multiple local llm models to their latest version. Using ollama list, you get a list of installed models, but pulling each model individually can be tedious. Automating this process saves time and reduces the potential for error.
For a condensed approach using awk and xargs:
ollama list | tail -n +2 | awk '{print $1}' | xargs -I {} ollama pull {}
The script pulls each model after skipping the header line from the ollama list output. The awk-based command extracts the model names and feeds them to ollama pull.