I described the basic usage of Screen in one of my last posts. I also mentioned a problem when using this tool.

In some cases, your terminal session may terminate, and so does your screen session. If you log in again and want to resume the screen, you probably get the error "screen is already attached" or "There is no screen to be resumed matching X". Follow the instruction to resume your screen session again.

How to detach an attached screen?

The initial situation:

screen -list
There are screens on:
25109.pts-1 (Attached)
25097.pts-1 (Detached)

Here you can see, that the first screen session is still attached.

The flag -D will detach and logout the remote.

screen -D 25109

You are now able to resume the screen again.

Please comment below, if you have any questions.

Tested on:

  • OS: CentOS 7
  • Screen: 4.01.00devel