0

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

stilliard
  • 762
  • 8
  • 27
  • 1
    Something like `new-session`? Or `detach`? It's not clear what you have or are looking for. – Nick Dec 19 '13 at 20:11
  • Please post the script and as @Nick said it's unclear what you're asking. – 에이바바 Dec 19 '13 at 20:52
  • Sorry but why was this downvoted? @Nick - Like detach, but to actually exit/kill them all. I'm thinking its best to just loop them and exit each like that. @ 에이바 - the rest of the script doesn't matter, i'm just looking for a way in tmux to bind some keys to exit/kill the windows, thanks – stilliard Dec 19 '13 at 22:03

1 Answers1

0

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.

Nick
  • 447
  • 4
  • 9
  • Thanks Nick, that works great at exiting, one minor thing i wonder if you could help me with, with this it unlinks and destroys perfectly, except it leaves my processes that each window was running still running, is there a way to kill those too? Or is it best to kill them individually. E.g. in one tmux window a watch script is running compiling sass and another coffeescript. If theres a way to do that with that tmux command that would be great, else thats fine it wont take much for me to just kill that process separately – stilliard Dec 19 '13 at 22:18
  • Actually, found a few other people looking for the same about killing spawned processes from the tmux session (e.g. http://superuser.com/questions/611047/quit-tmux-server-and-end-all-running-processes). I'll do something similar to them for them for now, unless you have any ideas @Nick? Thanks for this though. – stilliard Dec 19 '13 at 22:45