Connecting to screen

How do I attach a screen? I can see a screen is running in the following output, but can not connect to it.

[root@vishnuvm6 ~]# screen -ls
There is a screen on:
        15941.pts-18.vishnuvm6  (Detached)
1 Socket in /var/run/screen/S-root.

[root@vishnuvm6 ~]# screen -x vishnuvm6
There is no screen to be attached matching vishnuvm6.

Since it's the only screen running and it is detached, you can simply:

screen -r

If it was attached, you could:

screen -d -r

to detach it first (I prefer screen -Dr though: "detach and logout first")

or:

screen -x

which will leave all other attached displays intact. A nice trick if you want to tutor on a terminal (for example).


You need to name the screen only if there are other detached screens.


screen -d -r 15941.pts-18.vishnuvm6


I use screen -xRR quite always.

  • If no screen it starts one
  • If a screen exists, attach to it