Rename gnu screen session name

Author:

Ever wonder how you can rename your screen session name? You are in a hurry make a screen session execute some program and then you decide you want to leave the program executing there, but you named the session something not so informative like nothing (and get the default session name like “5026.pts-5.ubuntu” or similar…) or “test”. So there is an easy way of renaming the screen session name with a simple command of

screen -S <old_session_fullname> -X sessionname <new_session_name>

Here is the example for better clarity! Let’s say we have:

[root@srv ~]# screen -ls
There is a screen on:
        24624.test      (Detached)
1 Socket in /var/run/screen/S-root.

And here is the right renaming command. We want to rename the current gnu screen to “loganalyzing”:

screen -S 24624.test -X sessionname loganalyzing

As you can see you should use the fullname taken from the “screen -ls” command, in newer version you can use only the name like:

screen -S test -X sessionname loganalyzing

And here is the result:

[root@srv ~]# screen -ls
There is a screen on:
        24624.loganalyzing      (Detached)
1 Socket in /var/run/screen/S-root.

Leave a Reply

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