Completely Uninstall Ollama on Linux (Including Leftover Cleanup)

A practical, executable guide to fully remove Ollama on Linux by stopping and removing its service, binary, model files, and system user/group.

If you need to remove Ollama completely from Linux, follow the steps below in order. This guide cleans up the service, executable, model directory, and the ollama user/group.

Before You Uninstall

  • The commands below will delete local Ollama model files (usually in /usr/share/ollama). Back up first if needed.
  • These commands use sudo by default. Make sure your account has administrator privileges.

1. Stop and Remove the systemd Service

1
2
3
4
sudo systemctl stop ollama
sudo systemctl disable ollama
sudo rm -f /etc/systemd/system/ollama.service
sudo systemctl daemon-reload

2. Remove the Ollama Binary

1
2
3
4
OLLAMA_BIN="$(command -v ollama)"
if [ -n "$OLLAMA_BIN" ]; then
  sudo rm -f "$OLLAMA_BIN"
fi

3. Remove Ollama Library Directories (If Present)

If your installation wrote Ollama files into a lib directory, clean them up with:

1
2
3
for d in /usr/local/lib/ollama /usr/lib/ollama /lib/ollama; do
  [ -d "$d" ] && sudo rm -rf "$d"
done

4. Remove Model and Data Directory

1
sudo rm -rf /usr/share/ollama

5. Remove System User and Group (If Present)

1
2
id -u ollama >/dev/null 2>&1 && sudo userdel ollama
getent group ollama >/dev/null 2>&1 && sudo groupdel ollama

6. Verify Uninstall Completion

1
2
command -v ollama || echo "ollama binary not found"
systemctl status ollama || true

If ollama is no longer found in the checks above, the uninstall is complete.

Confirm What You Intend To Remove

Before deleting model directories, check whether another local tool reuses the same Hugging Face cache or data path. Removing the service and binary is reversible; deleting shared model data can force large downloads later, so archive or verify the path when disk space is not the immediate problem.