[GH-ISSUE #6987] Way to stop all running models #66479

Open
opened 2026-05-04 06:42:56 -05:00 by GiteaMirror · 8 comments
Owner

Originally created by @amytimed on GitHub (Sep 26, 2024).
Original GitHub issue: https://github.com/ollama/ollama/issues/6987

ollama stop all or ollama stop * etc

would be handy

Originally created by @amytimed on GitHub (Sep 26, 2024). Original GitHub issue: https://github.com/ollama/ollama/issues/6987 `ollama stop all` or `ollama stop *` etc would be handy
GiteaMirror added the feature request label 2026-05-04 06:42:56 -05:00
Author
Owner

@pdevine commented on GitHub (Oct 4, 2024):

Hey @amytimed what would the use case for that be?

<!-- gh-comment-id:2394065553 --> @pdevine commented on GitHub (Oct 4, 2024): Hey @amytimed what would the use case for that be?
Author
Owner

@amytimed commented on GitHub (Oct 4, 2024):

if the user is running some AI models and wants to stop all AI stuff to free up memory and whatnot they can just use one command for that

<!-- gh-comment-id:2394542001 --> @amytimed commented on GitHub (Oct 4, 2024): if the user is running some AI models and wants to stop all AI stuff to free up memory and whatnot they can just use one command for that
Author
Owner

@amytimed commented on GitHub (Jan 9, 2025):

if the user is running some AI models and wants to stop all AI stuff to free up memory and whatnot they can just use one command for that

also, many model names are quite long. If im running something like goekdenizguelmez/josiefied-qwen2.5-7b-abliterated-v2, the only reasonable way for me to stop it is to copy the model name from a list. With ollama stop all we can circumvent this

<!-- gh-comment-id:2581112536 --> @amytimed commented on GitHub (Jan 9, 2025): > if the user is running some AI models and wants to stop all AI stuff to free up memory and whatnot they can just use one command for that also, many model names are quite long. If im running something like `goekdenizguelmez/josiefied-qwen2.5-7b-abliterated-v2`, the only reasonable way for me to stop it is to copy the model name from a list. With `ollama stop all` we can circumvent this
Author
Owner

@pdevine commented on GitHub (Jan 18, 2025):

@amytimed for that case I was thinking about something like ollama stop goek and it would just match the rest of the name. It would just need to differentiate between different model names.

<!-- gh-comment-id:2599528358 --> @pdevine commented on GitHub (Jan 18, 2025): @amytimed for that case I was thinking about something like `ollama stop goek` and it would just match the rest of the name. It would just need to differentiate between different model names.
Author
Owner

@amytimed commented on GitHub (Jan 18, 2025):

maybe just wildcard of goek*, then stop * too

<!-- gh-comment-id:2599769985 --> @amytimed commented on GitHub (Jan 18, 2025): maybe just wildcard of `goek*`, then `stop *` too
Author
Owner

@aricshow commented on GitHub (Mar 7, 2025):

Not a built in command, but for what its worth this command works for me:
ollama ps | awk 'NR>1 {print $1}' | xargs -L 1 -I {} ollama stop {}

<!-- gh-comment-id:2707111753 --> @aricshow commented on GitHub (Mar 7, 2025): Not a built in command, but for what its worth this command works for me: `ollama ps | awk 'NR>1 {print $1}' | xargs -L 1 -I {} ollama stop {}`
Author
Owner

@carlosrojasg commented on GitHub (Jun 8, 2025):

Not a built in command, but for what its worth this command works for me: ollama ps | awk 'NR>1 {print $1}' | xargs -L 1 -I {} ollama stop {}

Based on your command I created this bat file for windows:
@echo off
echo Stopping all running Ollama models...

REM Loop through all model names from 'ollama ps', skipping header
for /f "skip=1 tokens=1" %%A in ('ollama ps') do (
echo Stopping model: %%A
ollama stop %%A
)

echo All models stopped.
pause

<!-- gh-comment-id:2954244389 --> @carlosrojasg commented on GitHub (Jun 8, 2025): > Not a built in command, but for what its worth this command works for me: `ollama ps | awk 'NR>1 {print $1}' | xargs -L 1 -I {} ollama stop {}` Based on your command I created this bat file for windows: @echo off echo Stopping all running Ollama models... REM Loop through all model names from 'ollama ps', skipping header for /f "skip=1 tokens=1" %%A in ('ollama ps') do ( echo Stopping model: %%A ollama stop %%A ) echo All models stopped. pause
Author
Owner

@Rabcor commented on GitHub (Feb 7, 2026):

shouldn't use wildcard, should use 'all' or some such., since wildcards would likely be read by the terminal as the files in the current directory which would be messy.

The obvious use case for this is scripting.

If you have a script that say uses one of your ollama models to translate text, you would usually want to terminate all running models before running the translation prompt, because if you don't have enough resources free to run the translation model then your command will fail and you don't get any translated text.

However it's not a major obstacle because of aricshow and carlosrajg's solutions

<!-- gh-comment-id:3865026474 --> @Rabcor commented on GitHub (Feb 7, 2026): shouldn't use wildcard, should use 'all' or some such., since wildcards would likely be read by the terminal as the files in the current directory which would be messy. The obvious use case for this is scripting. If you have a script that say uses one of your ollama models to translate text, you would usually want to terminate all running models before running the translation prompt, because if you don't have enough resources free to run the translation model then your command will fail and you don't get any translated text. However it's not a major obstacle because of aricshow and carlosrajg's solutions
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/ollama#66479