Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Send a keyboard shortcut to all of the panes for the current tmux session

I have some panes opened in tmux window. In all panes started performs some commands/programs. And I need to close all of them. Of course, I can manually switch to each pane and press Ctrl+C. However, it is to long. Is there some way of some sort of multicast the shortcut to all of the tmux panes?

like image 616
Loom Avatar asked Dec 10 '14 11:12

Loom


People also ask

How do you toggle panes in tmux?

Tmux uses the keybinding 'Prefix' followed by 'Ctrl+o' to cycle around the panes. When you use this key-binding for the first time, it moves the pane in one position clockwise.

How do I list all tmux sessions?

To enter command mode, type prefix>: followed by list-sessions or ls to view a list of currently active Tmux sessions. By default, list-sessions are bound to the prefix> s key combination. With j and k, you may explore the session list and activate one by hitting enter.

How do I resume a tmux session?

To disconnect from your session, but still leave it running, hit Ctrl+B and then D. To resume the session, I can run: $ tmux ls ### to see if there are any other tmux sessions $ tmux a ### this will connect to the most recent session that was created.


1 Answers

There is a command in tmux, that lets send any commands/shortcuts to all of the panes:

PREFIX:setw synchronize-panes

PREFIX is a standard keyboard shortcut activates tmux. It's CtrlB in my tmux (other have CtrlA, for example)

Actually, I bind a couple of keyboard shortcuts in ~/.tmux-conf to switch on/off panes synchronization:

bind e setw synchronize-panes on
bind E setw synchronize-panes off
like image 96
Loom Avatar answered Sep 24 '22 19:09

Loom