Screen: can I execute commands and split the window when starting screen

gnu-screen

I use the screen command on several servers, where I monitor several log files. I arrange the log files to my preferences with several splits and by naming the regions. Sometimes the server gets rebooted or I have to log out from the screen session for various reasons, and it is tedious to set the this up manually every time. Is there a way to script this somehow, so that screen opens up with e.g. three split regions initially with specific names and executes a command in each region?

Best Answer

use ~/.screenrc on the server.

example:

split
screen -t top top
focus
screen -t shell

where:

split — splits current window/region horizontally

focus — switch to next region

screen -t name [command] — set name for current window/region and run command

Related Question