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?

  • There was a similar question on Super User: superuser.com/questions/687348/… You may wish to check out terminator that I mention in my answer there. Not exactly what you're asking since it's not screen-based but should be helpful for you. – Erathiel Jun 2 '15 at 14:04
  • Thanks, I checked out the answer. Terminator sounds interesting, I was not aware of that. Unfortunately, I'm using SuSE Linux 11 and am not allowed to install additional binaries. – simon Jun 2 '15 at 14:12
  • @simon you can use a standalone version of terminator by downloading a pre-compiled latest version it from its project page, extracting it and running the terminator executable. Did saving the screen layout work for u? – Wilf Jun 2 '15 at 14:54
  • @wilf, thanks for the suggestions. Saving the screen layout did not work - I assume that the screen version installed is too old: "4.00.02 (FAU) 5-Dec-03" Using the pre-compiled executable is unfortunately also out of the question, because of security reasons - I can only run programs from the official distribution or pre-approved in my organization. – simon Jun 2 '15 at 15:03

use ~/.screenrc on the server.


screen -t top top
screen -t shell


split — splits current window/region horizontally

focus — switch to next region

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

  • Thanks, this works. In my case I don't have an own user account, but I created a separate configuration file and start screen with the -c option to specify the configuration file. – simon Jun 3 '15 at 7:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.