Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

After modified screenrc, how to see the changes without restarting screen?

share|improve this question
add comment

3 Answers

up vote 43 down vote accepted

You could try Ctrl-a : source ~/.screenrc.

share|improve this answer
5  
Sourcing the file should work. Detaching and reattaching will not. –  Zed Oct 25 '10 at 19:35
1  
@Zed: But it will re-apply the termcap/terminfo stuff which will not happen when you use source. –  Dennis Williamson Oct 25 '10 at 19:36
    
@Dennis, I tried detaching and reattaching and it didn't work, hence I came to ask this question. Also, using source can open all windows from .screenrc, however it doesn't refresh the session, but creating duplicate windows in one session. Thanks. –  garconcn Oct 25 '10 at 22:17
2  
Using "source" is the correct (and only) way to have screen re-read the .screenrc in a running session. Yes, this means it will re-run any commands you have inside it, including commands that create windows or layouts. You could edit the file to comment out the commands that create thew new windows/layouts; source the file; and then un-comment those lines. Of course, if it's the window creation you're wanting to test, you don't have much choice here... –  James Polley Oct 25 '10 at 22:46
4  
@garconcn: If this is something you might do frequently, put that stuff (non-screen-creation instructions) in a second file and source it from .screenrc (which will contain your screen creation instructions) for regular startup and when you need to source it again after screen has already started, just do "ctrl-a : source secondary-file" to skip the screen-creation stuff. –  Dennis Williamson Oct 25 '10 at 23:53
show 2 more comments

I tried the the option mentioned here - Ctrl-a : source ~/.screenrc and it didn't work for me.

This is what worked for me - Ctrl-a : source $HOME/.screenrc

share|improve this answer
    
It would be normal to expect ~ to expand to your home directory. –  Iain Dec 8 '11 at 11:44
    
@Iain I know, ideally it should. I guess something was wrong with my ENV then. Nevertheless, it worked. –  holydevil Dec 13 '11 at 10:41
    
I had this exact same issue on CentOS 5. –  slm Dec 22 '12 at 3:28
    
Same issue with zsh and oh-my-zsh on archlinux. –  Jaseem Nov 23 '13 at 9:39
add comment

I have this in my .screenrc file:

bind R eval "source $HOME/.screenrc" "echo '.screenrc reloaded!'"

Which causes screen to reload the .screenrc file when Ctrl-AShift-R is pressed.

Of course, this only works if you've already got the line in your .screenrc file! To 'bootstrap' this sortcut on an existing screen session, add the line above line to your .screenrc file and then follow @Dennis Williamson's answer. After that, you'll be able to use the new keyboard shortcut.

share|improve this answer
    
Neat, thank you! –  Tobias Kienzler Oct 9 '12 at 12:34
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.