Screen command is a command we use to ensure that the command is not interrupted. Well, internet connection is interrupted. So I want to go back.

I typed screen and go to a new screen.

What about if I want to visit the previous screen, where I ran the command?


In case you have 1 screen session use:

screen -r

In case you have many you should first list them:

screen -ls

[root@gigan root]# screen -ls
There are screens on:
        31619.ttyp2.gigan       (Detached)
        4731.ttyp2.gigan        (Detached)
2 Sockets in /tmp/screens/S-root.

And then re-attach to the correct one:

[root@gigan root]#screen -r 31619.ttyp2.gigan

Those are other information can be found at http://www.rackaid.com/blog/linux-screen-tutorial-and-how-to/

BTW. I recommend getting familiar with CTRL+A ^X x - this lock the screen of screen until you provide user password ;)


Use screen -r. From man screen:

   -r            Reattach to a detached screen process.

or screen -x


Attach to a session which is already attached elsewhere (multi-display mode). Screen refuses to attach from within itself. But when cascading multiple screens, loops are not detected; take care.

screen -dr

r means “reattach” and d means “detach elsewhere” (in case your server hadn't noticed yet that the previous remote connection was interrupted).

If you have multiple screen instances running, you'll be shown a list. Call screen -dr with an extra argument that an unambiguous part of the name of the instance.

You can choose an instance name (session name) with screen -S somename.


screen -ls or screen -list will generate you the list of screen sockets available currently.

screen -x <socket_name> attach an existing screen session

screen -Dr <socket_name> reattach and detach if necessary

screen or screen -S <session_name> will generate you a newer screen to work on.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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