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

Solution 1:

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.

Solution 2:

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.