Search code examples
tmux

How to send a command to all panes in tmux?


I like to call :clear-history on panes with a huge scrollback. However, I want to script a way to send this command to all the panes in the various windows.

I know how to send a command to all the windows, courtesy of this question, but how do I send a command to all the panes of which window as well?

send-keys and synchronize-panes from the tmux manpage come to mind, but I'm not sure how to marry them together. But maybe there is a simpler way to do this.

Extra Observations:

Thinking about this a little bit, tmux list-panes -a seems to list all the panes in the current session. Pretty useful to start off with. Where do I go from here?


Solution

  • Have you tried following in tmux window with multiple panes

    Ctrl-B :
    
    setw synchronize-panes on
    
    clear history