Configure Your Own screenrc file

screenrc

There are few shell scripts I need to run when I log on to my server. One of my favorite is to use screen to launch the scripts when I log on to the server or using screen to access multiple screen. screenrc file does help me on this, I can build my own screenrc file and update screenrc file whenever I have new script or command wanted to run when I log on to the server. Here is how I configure your personal screenrc file.

By default, screen will read .screenrc file (if you have one) in your home directory. But sometime you might use screen to do other stuff/work, a simple example of write your own screen. Create a screenrc file, for example I created a screenrc file name grabdata.screenrc, and the content of the file


screen -t google.com lynx http://www.google.com
screen -t myemail mutt /mail/paul/inbox
screen -t latestlog tail -F /var/log/message
screen -t checkdiskspace sh /home/paul/script/check-disk-space.sh

After you have build your own screenrc file, launch it will this line of command


screen -S mystartup -c grabdata.screenrc

screen -S mystartup is to assign a screen name
screen -c grabdata.screenrc is to launch screen command with your screenrc file

There are others stuff you can do with screenrc file, man for more info.