Auto-start Screen

Written by Peter Davies on .

Recently I had the task of updating a large remote database. Occasionally my laptop would lose it's wireless connection so I remembered the old faithful "screen" and thought how handy would it be to get it automatically started when logged into a remote shell.

In the case of the gentoo box I am accessing I simply placed at the bottom of the file ".bash_profile"

exec /usr/bin/screen -R

It's also handy to be reminded that your using screen, so by editing the ".bashrc" file you can add:

if [ "$TERM" = "screen" ]; then
echo "Running Screen."
fi

This little tip means that each time you log in to the system, it will start screen using the last created session (-R = reattach). I modified the screen config file to increase the "defscrollback", located here: nano /etc/screenrc