None of the above answers worked for me (tmux v2.3), but this came from the bash command line:
for _pane in $(tmux list-panes -a -F '#{pane_id}'); do \ tmux clear-history -t ${_pane} ; done
A more generalized script, for tmux commands other than 'clear-history', will simply replace this element with a parameter, for example. $ 1. Be careful if you intend to write a script to handle a series of tmux commands, since "-t $ {_ pane}" will need to be applied to everyone.
Note that the -a option for tmux list-panes is required to cover all panels in all windows in all sessions. Without this, only the panels in the current tmux window will be affected. If you have multiple tmux sessions open and want to apply the command to the panels in the current session, replace -a with -s (all this on the tmux man page).
I do not have mods to comment directly on each of the above answers, so this is why they did not work for me:
The problem I ran into @ shailesh-garg's answer was that the synchronization affected only the commands issued in the panels, not the tmux commands issued with Ctrl-B : which are outside the panels.
The three problems I had with @kshenoy's answer were as follows:
- it sends keystrokes to the panel, and not to the tmux operation of that panel, for example, if you had a bash shell working in the panel and one used the script to send "clear-history", there will be keystrokes that appear on the bash command line. A workaround would be to send "tmux clear-history" or tentatively defer "tmux" to "$ @", but I did not edit the answer due to my other answer problem;
- I could not understand how to send a new-line character without literally breaking the line;
- Even when I did, sending "tmux clear-history" had no effect.
user1404316 Aug 04 '17 at 21:02 on 2017-08-04 21:02
source share