【问题标题】:How can I reattach to tmux process如何重新附加到 tmux 进程
【发布时间】:2014-05-01 06:51:20
【问题描述】:

我今天不得不重启我的盒子。我有几个程序在 tmux 会话中运行。他们似乎还活着,我怎样才能重新连接到他们? 我试过tmux a processID,但没用。

/home/me 21$ ps aux | grep tmux
me    1299  0.0  0.0  22244  1920 ?        Ss   Apr28   0:40 tmux -2 -f /tmp/r-plugin-me/tmux.conf new-session -s vimrpluginme1398670569alnn51oynp1vollnn51f2v4r_ied_delta1meRalphaCalibr VIMINSTANCEID=alnn51oynp1vollnn51f2v4r_ied_delta1meRal
me    2575  0.0  0.0  54164  3500 ?        S    07:35   0:00 xterm -e tmux -2 -f /home/me/.tmux.conf -S /tmp/vX0qRrR/78
me    2577  0.0  0.0  19892  1400 pts/2    Ss+  07:35   0:00 tmux -2 -f /home/me/.tmux.conf -S /tmp/vX0qRrR/78
me    2579  0.0  0.0  22128  1832 ?        Ss   07:35   0:00 tmux -2 -f /home/me/.tmux.conf -S /tmp/vX0qRrR/78
me    5155  0.0  0.0   6380   756 pts/4    S+   07:46   0:00 grep tmux
me   31340  0.0  0.0  23348  3000 ?        Ss   Apr28   0:17 tmux -2 -f /home/me/.tmux.conf -S /tmp/vIqEM06/78

【问题讨论】:

  • 我假设您的意思是 tmux 会话正在另一台机器上运行,因为我看不出它们如何在运行它们的机器上重新启动。

标签: tmux


【解决方案1】:

您不能重新附加进程 ID。您需要重新附加相应的tmux 会话。

tmux ls 也是如此。选择您要重新附加的任何会话。然后执行tmux attach -d -t <session id> 将其重新附加到新的 tmux 实例并从旧实例中释放它。

【讨论】:

  • 如果您只分离了一个会话,也可以使用 tmux attach
  • tmux a -t <session id> 似乎也对我有用。
【解决方案2】:

如果你只分离了一个会话,你可以这样做

tmux attach

另外,如果您要在多个会话中工作,最好为您的会话命名

tmux new -s ssh-to-staging
Ctrl b, d   # Detach from session
tmux new -s ssh-to-s3
Ctrl b, d   Detach from session

现在,当您执行tmux ls 时,您可以更轻松地重新连接而无需猜测。

tmux attach -d -t ssh-to-s3

你可能还想bookmark this cheat sheet

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2023-03-14
    • 1970-01-01
    • 1970-01-01
    • 2012-04-24
    • 2011-04-25
    • 2016-09-20
    • 1970-01-01
    • 2015-09-21
    相关资源
    最近更新 更多