How to rename an already existing screen session?

We already discussed different topics on “screen” command in our previous discussions. You can refer to our previous topics for more details on that. 1) Screen command usage 2) How to access attached screen after connection dropped?

The screen command under the Unix is used to execute some process under or inside a screen. That means you can simply detach from the screen and keep working on that server. It is normally very helpful when you need to install some large (time consuming applications) on the server. In this case, you can execute that installation on a screen. The process still runs on that screen, even if you got connection dropped. After sometime you can re-attach that screen and control that particular process.

In this topic I’m going to explain how to rename an already existing screen session.

You can simply create a new screen session by executing the “screen” command. If you want a specific name for your newly creating screen session, use the “-S” switch along with the screen command.


# screen -S testsession

To list running screen sessions, use “screen -ls

# screen -ls
There is a screen on:
        12129.testsession       (Detached)
1 Socket in /var/run/screen/S-root.

Yeah, here we go!! Renaming the screen session name “testsession” to something else. Here is the command to rename the existing session.

# screen -S 12129.testsession -X sessionname newname

Where “newname” is the new session name. That’s it 🙂

Now list the existing screen sessions. You can see the difference.

# screen -ls
There is a screen on:
        12129.newname   (Detached)
1 Socket in /var/run/screen/S-root.

Okay. Let me know if you have any questions.

Arunlal Ashok

Linux Server Administrator. I'm dealing with Linux servers since 2012. I started this blog to share and discuss my ideas with the world. Check My Profile!! in uPwork (oDesk) and let me know if you need any assistance. Thanks!!

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *