Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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 I'm curious as to whether there is a more concise way.

share|improve this question
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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .