How to kill all tmux sessions (or at least multiple sessions) from the CLI?

You can use tmux kill-server to cleanly and gracefully kill all tmux open sessions (and server).

If you are inside a tmux session you would like to keep, use tmux kill-session -a to close all other sessions.

To close a specific session, use tmux list-sessions to identify the session you want to kill, and then use tmux kill-session -t targetSession to kill that specific session.

Also you can grossly kill all tmux processes with pkill -f tmux.

Hope it helps.


I can kill all of these processes with the command:

pkill -f tmux

It kills all processes (full list) of the matching name (tmux).


Note for newcomers: This way could serve you to kill all process of other matching names.


This would list and kill all the sessions:

tmux list-sessions | awk 'BEGIN{FS=":"}{print $1}' | xargs -n 1 tmux kill-session -t

Tags:

Process

Tmux