Unfortunately there does not appear to be a simple default keybind to do this, possibly because it's an action you might want to be careful about though this could be addressed with a confirm dialogue.
One way is C-x :
to get the tmux prompt and kill-session
As @Vaisakh-k-m pointed out C-x
w
gives you an interface to select windows across multiple sessions which you can select with the arrow keys and t
to toggle the tagged status then X
to kill the tagged windows and y
to confirm this action.
This way there is no need to type a command at the prompt (accessed with C-x
:
)
kill-server
kills all sessions not merely the current one
If you'd like a custom kill session keybind @user79262 suggests these additions to your .tmux.conf
:
bind C-x confirm-before -p "kill other windows? (y/n)" "kill-window -a"
bind Q confirm-before -p "kill-session #S? (y/n)" kill-session
You can close the current window with: C-x
(Your prefix Ctrl+a
in the case of the OP, Ctrl+b
by default)
then &
and confirm with y
This shortcut kills the window but not the current session unless your are in the last open window.
If you run tmux ls
you'll see that with C-x
d
the session is still running in the background. You can re-attach to these background sessions with tmux a -t <session>
where session is a name number.
Ctrl
+a
->s
) and then pressx
with the target section selected, followed byy
to confirm. No typing:kill-session
, no rebinding