Search code examples
shelltmux

How to kill all tmux windows at the same time using tmux command.?


I created a shell script to start tmux (in Mac) It used to work but not after upgrade OS and computer The last command supposed to close all windows and quit. Any help ? Thanks

tmux new-session \; \
  setw -g base-index 1 \; \
  setw -g pane-base-index 1 \; \
  split-window -h  -p 65 \; \
  send-keys 'vim' C-m \; \
  split-window -h -p 50 \; \
  select-pane -t 3 \; \
  split-window -v \; \
  send-keys 'guard' C-m \; \
  select-pane -t 2 \; \
  set -g mouse-select-pane on \; \
  set -g mouse-resize-pane on \; \
  bind-key Q kill-session \;

tmux 3.2a

MacOS Big Sur Version 11.6.2


Solution

  • in ~/.tmux.conf include this line:

    bind-key Q kill-session
    
    

    Now bind-key then Q will exit all