Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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.
share|improve this question
From man screen: "-x Attach to a not detached screen session." – Dennis Williamson Mar 4 '11 at 5:34
@Dennis: That just means existing clients, if any, won't get detached. – grawity Mar 4 '11 at 6:20
@grawity: Well, you're right, but that wording is very poor. – Dennis Williamson Mar 4 '11 at 6:48
up vote 10 down vote accepted

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")


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.

share|improve this answer

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

share|improve this answer

I use screen -xRR quite always.

  • If no screen it starts one
  • If a screen exists, attach to it
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.