I am running a screen session and I'd like to change it's name. I know that when starting a new screen session I can use the '-S' option to give it a name. How do I change that name once the session has already started?
There is a screen command to do this. From the manual:
Command: sessionname [name]
Rename the current session. Note that for
screen -listthe name shows up with the process-id prepended. If the argument name is omitted, the name of this session is displayed.
$STYenvironment variable still reflects the old name. This may result in confusion. The default is constructed from the tty and host names.
To access the screen command line, use Prefix:, where Prefix is typically Ctrl-a.
So you will most likely have to do so:
To rename the window title within a screen session use:
- press and release Ctrl+a and then press Shift+a
To rename the actual session name (displayed with
screen -ls) use:
:sessionname newName. More details at https://superuser.com/a/370553/65975.
# screen -S old_session_name -X sessionname new_session_name