Attach to an already attached screen

published on January 09, 2020.

Today I ran into a strange error with screen. I was working on a remote server, executing commands in screen when my connection got dropped. I reconnected, wanted to reattach to my screen session with the usual -r option:

screen -r foo

But this greeted me with an error of:

There is a screen on:
	7608.foo	(Attached)
There is no screen to be resumed matching foo.

screen -ls confirms there is a screen session for “foo”. Apparently I came back to the server so quick that screen didn't realize I got dropped from the session and it still thought I was there.

The solution is to run the screen command with -rd:

screen -rd foo

This tells screen to first detach the session and then reattach to it.

Another solution is to run the screen command with -x:

screen -x foo

This tells screen to reattach to an already attached session.

Happy hackin’!

Tags: screen.
Categories: Software, Development.

Thanks for reading! I would like to help you make your web application better, so let's talk.

Robert Basic

Robert Basic

Software developer making web applications better.

Let's work together!

I would like to help you make your web application better.

Robert Basic © 2008 — 2020
Get the feed