bash - 如何找到特定 tmux session 上正在运行的程序?

标签 bash ssh tmux

在远程机器上,我有一个 ID 为 selu 的 tmux session ,我正在运行一个 python 程序 python test.py 以不同的参数多次运行 C++ 程序 main.cpp。我想了解该 session 中当前正在运行的 C++ 程序的参数。我该怎么做?

最佳答案

您可以信赖 run-shell命令。下面是如何grep 事件 Pane 的当前事件进程的示例。

 bind-key M-v run-shell 'T=$(tmux display -p "#{pane_tty}" | sed "s=/dev/=="); if pgrep -t$T "fzf|vim|elvish" &> /dev/null; then tmux send-key M-v; elif pgrep -t$T "gdb" &> /dev/null; then tmux send-key PageUp; else tmux copy-mode; fi'

您还可以添加 -t <your session>run-shell以便指定所需的 session 。

关于bash - 如何找到特定 tmux session 上正在运行的程序?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51445703/

相关文章:

unix - 当删除一个窗口时,如何使 tmux 重新排序?

linux - 加载共享库时出错 : libevent-2. 0.so.5

linux - 如何在 bash 中使用带有 -exec 的 'cat' 命令?

google-chrome - ssh AWS,Jupyter Notebook 未显示在 Web 浏览器上

ssh - 根据提交者名称拒绝推送

macos - OS X Lion上的tmux "Socket is not connected"错误

bash - 来自 Java 进程的 shell 函数错误 "exporting"

regex - 给定单词列表,对文本正文进行全词匹配

linux - 如何为行编写 while 循环

javascript - '类型错误 : Object is not a function' when using tunnel-ssh