Send command to all window in tmux

萝らか妹 提交于 2019-11-30 00:21:12

问题


Is a way to send the same command to all window in tmux, not to all pane in window. synchronize-panes - send command to all pane in one window. I need something like 'at' in screen.


回答1:


You could always do something like this:

session=mysession
message="hello world"
tmux list-windows -t $session|cut -d: -f1|xargs -I{} tmux send-keys -t $session:{} $message

You could also bind this to a key in your tmux.conf like this:

bind C-e command-prompt -p "session?,message?" "run-shell \"tmux list-windows -t %1 \| cut -d: -f1\|xargs -I\{\} tmux send-keys -t %1:\{\} %2\""



回答2:


You could do something like this: https://gist.github.com/2773454

But this executes for every pane, but you could adjust accordingly.

All depends what your trying to accomplish, for this an example of what i want to accomplish is to source ~/.zsh in all panes.



来源:https://stackoverflow.com/questions/9250884/send-command-to-all-window-in-tmux

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!