Screen: Rename Session

A named screen session can be started by using the screen -S <sessionName> command.

If you start a simple screen session, by default, it will be named as something like 55355.pts-0.hostname.

No matter how the screen session has been started, it can be easily renamed at any time.

This short note shows how to rename a GNU screen session in Linux.

Cool Tip: Run a background process using the Linux screen command! Read more →

Rename Screen Session

List the currently running screen sessions:

$ screen -ls
- sample output -
There are screens on:
	55355.pts-0.hostname	(04/12/2022 10:39:06 AM)	(Detached)
	55309.pts-0.hostname	(04/12/2022 10:38:48 AM)	(Detached)
2 Sockets in /run/screen/S-username.

To rename the screen session, execute:

$ screen -S <PID>.<sessionName> -X sessionname <newSessionName>
- example -
$ screen -S 55355.pts-0.hostname -X sessionname INC-18234

Run the command below once again to ensure that the screen session has been renamed:

$ screen -ls
There are screens on:
	55355.INC-18234		(04/12/2022 10:39:07 AM)	(Detached)
	55309.pts-0.hostname	(04/12/2022 10:38:49 AM)	(Detached)
2 Sockets in /run/screen/S-username.

Cool Tip: How to Scroll Up while running the screen command! Read more →

Was it useful? Share this post with the world!

Leave a Reply