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.

I typically use about 10 windows in gnu screen and am constantly customizing my .bashrc. I would like to be able to source .bashrc across screen windows with a one-liner. Can I broadcast a command to all my screen windows without detaching my session, running the command (in this case, sourcing the profile) and re-attaching to the screen session? I use Mac OS 10.8.

I believe this solution will also work for what I want to do, but curious if there is a more concise way.

share|improve this question

1 Answer 1

up vote 2 down vote accepted

From the Screen User Manual, you can send arbitrary text to all screen windows via it's -X command line argument combined with the builtin screen commands at and stuff with the following command, in your case

screen -X at \# stuff "source ~/.bashrc\n"

Keep in mind that this command is the equivalent to typing "source ~/.bashrc" in to every window. If a window isn't at a bash prompt and is instead say, editing a file with vim, it will have some unexpected results.

share|improve this answer

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.