Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Is it possible to change the name of a GNU screen session? Say I called started it with "screen -S foo" and I want to rename it to bar.

share|improve this question
    
Duplicate of stackoverflow.com/questions/3202111/… –  l0b0 Aug 9 '12 at 8:00
1  
@l0b0 That's about naming. This is about renaming. –  marcog Aug 9 '12 at 18:06
add comment

2 Answers

up vote 77 down vote accepted

Summary

C-a :sessionname mySessionName

Details

This is,

0) Attach to the session in question.

1) Ctrl + a

2) Type ":sessionname mySessionName" - yes, the first colon is needed there, no extra spaces.

3) Type Enter.

Example

$ screen -S foo
[detached from 8890.foo]
$ screen -ls
There is a screen on:
    8890.foo    (22/12/11 18:39:22) (Detached)
1 Socket in /var/run/screen/S-user.

$ screen -r

( "C-a :sessionname bars" here )

[detached from 8890.bars]
$ screen -ls
There is a screen on:
    8890.bars   (22/12/11 18:39:21) (Detached)
1 Socket in /var/run/screen/S-user.

$ 

Renaming without attaching

Screen's -X switch lets you rename a session without attaching it.

$ screen -X sessionname foobars
$ screen -ls
There is a screen on:
    8890.foobars    (22/12/11 18:39:22) (Detached)
1 Socket in /var/run/screen/S-user.

$ 
share|improve this answer
add comment

If there are several sessions, use:

screen -S 8890.foo -X sessionname bar
share|improve this answer
2  
This is a better answer than the one above because it deals with the general case of multiple sessions –  doon May 21 '13 at 17:21
    
This is the best answer –  Coc Dec 3 '13 at 10:18
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.