База знаний
База знаний:
screen: как вернуться к нужной сессии эмулятора экрана Linux
Автор [ADMINGROUP] Oleksandr Usov на 17 August 2014 03:27 PM


How to access attached screen after connection dropped

Here’s the situation, you are using bash’s Screen command because you don’t want your flakey internet connection to affect whatever you are working on, and sure enough, the connection drops. Sometimes, when you try to re-attach to this screen session you are told that the screen session is still attached…

~$ screen -r '1234.somescreensession'
There is a screen on:
1234.somescreensession (Attached)
There is no screen to be resumed matching 1234.somescreensession.

How annoying.

Here is a simple way to take back that screen session.

screen -D -r '1234.somescreensession'

Kudos to Donncha O’Caoimh

Here is a way a longer way to remove the process that is attached to that screen session, so you can reattach to it and continue with whatever you were doing.

  • figure out which tty is holding on to the screen session by typing into terminal
    ps -ef | grep screen | grep tty
  • result of this should be something like
    testdev 5760 5688 0 12:31 ttyp1 00:00:00 screen -r 1234.somescreensession
  • in this case the tty is 5688, use this to find the login bash that is associated with that tty
    ps -ef | grep bash | grep 5688
  • result of this should be something like
    testdev 5688 5687 0 12:28 ttyp1 00:00:00 -bash
  • kill process
    kill -9 5687

Now you should be free to re-attach to this screen session.

Kudos to David Mackintosh

Комментарии (0)
Добавить новый комментарий
Полное имя: