screen使用问题,重新attach失败:There is no screen to be resumed matching ***

reatach一个session:
方法1:

screen -xr 5170.pts-21.hostname

-x: Attach to a not detached screen session. (Multi display mode).

or:

screen -d -r 5170.pts-21.hostname
screen -D -r 5170.pts-21.hostname

-d -r: Reattach a session and if necessary detach it first.
-D -r: Reattach a session. If necessary detach and logout remotely first.

若以上还不行,会话不能重新attach,即screen -r ID失败,原文链接
figure out which tty is holding on to the screen session by typing into terminal

ps -ef | grep screen

result of this should be something like
testdev 5170 5572 0 12:31 ttyp1 00:00:00 screen -r 1234.somescreensession
可以找到screen -ls 中对应的pid,例如 5170 ,然后可以看到其父进程id为 5572

找到holding该会话的bash的pid,in this case the tty is 5572 , use this to find the login bash that is associated with that tty:

ps -ef | grep bash | grep 5572

然后kill it:

kill 5572


screen reattach相关的一些命令:

-d|-D [pid.tty.host]
does not start screen, but detaches the elsewhere running screen session. It has the
same effect as typing “C-a d” from screen’s controlling terminal. -D is the equivalent
to the power detach key. If no session can be detached, this option is ignored. In
combination with the -r/-R option more powerful effects can be achieved:

-d -r Reattach a session and if necessary detach it first.

-d -R Reattach a session and if necessary detach or even create it first.

-d -RR Reattach a session and if necessary detach or create it. Use the first session if
more than one session is available.

-D -r Reattach a session. If necessary detach and logout remotely first.

-D -R Attach here and now. In detail this means: If a session is running, then reattach.
If necessary detach and logout remotely first. If it was not running create it and
notify the user. This is the author’s favorite.

-D -RR Attach here and now. Whatever that means, just do it.

哈,家里的小工厂,占个位: http://www.herofireworks.com/

你可能感兴趣的:(detach,screen,session,matching,linux常用命令)