Linux – create and manipulate unix “screens” in a script

gnu-screenlinuxscriptingunix

I have a work environment on my Ubuntu laptop in which I want to use three different screens.

Eg. in terminal, I usually write

screen -S mywork
run_server_1

then, ctrl-a c to create a second screen

run_server_2

etc.

I'd like to write a script to automate setting up this environment, but how can I control multiple screens from one script?

Update : I really want to be able to do this from a shell script, not a screen config. file. Is there a way to do that?

Best Answer

Reading man pages and tutorials helps

I would say that you want to do is create a file $HOME/.screenrc.multiwin

# read in your normal screenrc
# before anything else
source $HOME/.screenrc
# now start opening windows
# it's possible to set the window title with
# the -t option
# you can also specify the window number
# to launch in
screen -t server1 5 run_server_1
screen -t server2 6 run_server_2

Then running

screen -c $HOME/.screenrc.multiwin

will do what you need

Related Topic