向 tmux 中的所有窗口发送命令

发布于 2025-01-04 19:36:41 字数 86 浏览 5 评论 0原文

是一种将相同命令发送到 tmux 中所有窗口而不是窗口中所有窗格的方法。同步窗格 - 将命令发送到一个窗口中的所有窗格。我需要在屏幕上显示类似“at”的内容。

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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

月亮邮递员 2025-01-11 19:36:41

你总是可以这样做:

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

你也可以将其绑定到 tmux.conf 中的一个键,如下所示:

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\""

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\""
浅忆 2025-01-11 19:36:41

你可以这样做: https://gist.github.com/2773454

但这对每个窗格,但您可以进行相应调整。

一切都取决于您想要完成的任务,为此,我想要完成的一个示例是在所有窗格中获取 ~/.zsh 。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文