Server Fault is a question and answer site for system and network administrators. 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 have a couple of VM images that I run on a regular basis on my FreeBSD 9.0 fileserver.

I have scripts written that start them with my desired settings (startUbuntuVM and startWindowsVM).

I would like to write a script that does the following:

1) Start a screen session named 'virtualbox'
2) Add one window named 'Ubuntu' that runs the 'startUbuntuVM' command.
3) Add a second window named 'Windows' that runs the 'startWindowsVM' command.

I've seen the -X flag for screen but as far as I can tell it only works from within another running screen process.

Is there any way to do what I want? I don't want to script it within .screenrc because I only want this to be done when I want, not during every screen session start.

share|improve this question
up vote 3 down vote accepted

Something like this script below?

[ -z "$STY" ] && exec screen -S virtualbox "$0" "$@"

screen -t Ubuntu ./startUbuntuVM
screen -t Windows ./startWindowsVM

# uncomment following line to detach from screen
#screen -d
share|improve this answer

Your Answer


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.