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 blog post I’m explaining 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.

This post was published on Oct, 2018. Verified with new versions and updated. In case of any issues, please comment. Our team will reply or update the post as soon as possible.

Example

# 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.

, ,

Post navigation

Arunlal A

Senior System Developer at Zeta. Linux lover. Traveller. Let's connect! Whether you're a seasoned DevOps pro or just starting your journey, I'm always eager to engage with like-minded individuals. Follow my blog for regular updates, connect on social media, and let's embark on this DevOps adventure together! Happy coding and deploying!

5 thoughts on “How to rename an already existing screen session?

Leave a Reply

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