Search code examples
bashterminalexittmuxquit

tmux bind-key to kill all or maybe a grouping of windows/panels


I've created a script that opens up tmux and splits into 4 windows/panels, but i was wondering if theres a quick way to exit them all, preferably via a key binding. Thanks.

[Edit]

What i'm looking for is a way to exit a selection of windows via a key binding. Something maybe i can add to my .tmux.conf file like: bind-key C-c exit-all Or maybe a command i can pass in after setting up the split windows etc like: tmux bind-key C-c exit-all

I'm putting exit-all as the command there as thats what im looking for, but i don't know the real name for this function or way of doing this


Solution

  • From man tmux:

    unlink-window [-k] [-t target-window]
                  (alias: unlinkw)
            Unlink target-window.  Unless -k is given, a window may be unlinked only if it is linked to multiple ses-
            sions - windows may not be linked to no sessions; if -k is specified and the window is linked to only one
            session, it is unlinked and destroyed.
    

    I think unlink-window -k is what you're after.