Max Schmitt

October 20 2020

How to close all tmux panes at once

I like to write little tmux scripts that help me boot up the dev-servers of whatever project I'm about to work on.

Just as I like to be able to start working on a project with a single command, I like to be able to stop working on it quickly, so I can switch over to something else.

I've bound Prefix + X to close all panes in a tmux session at once, basically killing the entire tmux session.

To do the same, just add the following code to your .tmux.conf:

bind X confirm-before kill-session

You might need to kill any remaining processes even once your tmux session was killed, which is why I usually run killall node right after. :)