Make GNU Screen Your Default Shell

More on GNU Screen

Using GNU Screen can make life much easier, but how often do you start a job and then realize "I wish I'd started screen first"? I used to do it all the time, then I configured things so screen starts by default when I log into my server.

GNU Screen is incredibly helpful, but like any tool, it must be running to be of use. Rather than starting a job and thinking, 'I wish I'd started Screen first,' why not configure Screen so it starts by default when you log in to your server? Here's how.

Why do I want screen to start automatically when I log in? Like many folks, I work from more than one computer. I like to be able to SSH into a machine and pick up where I left off from another system. Many admins and other users like to run their IRC sessions with a combination of GNU Screen and irrsi, just so they can have a persistent session. The more you use screen, the more you'll find that it's a good idea to jump right in on startup. But to do that, you must either remember to start screen every time, or do it automatically. I vote for the automatic startup.

Sometimes people try to set GNU Screen as the default shell. That might work to some extent, but you also get some weirdness with programs that look into /etc/passwd for your default shell. The best way to do it is to simply start screen from your ~/.profile or ~/.bash_profile.

How to do that? It's a piece of cake, just add screen to the .profile or .bash_profile, and you're good to go.

Another tip? Turn off the default screen message by editing /etc/screenrc and adding this to the configuration file:

startup_message off

If you're an Ubuntu user, you can also use byobu in place of screen. See Juliet Kemp's recent piece on Byobu for more on that.

Final note -- if you're already logged into a session, you'll need to log out or source your profile before it will take effect.

GNU Screen is a powerful ally, use it well and often, you'll find it can help make life much easier.

Joe 'Zonker' Brockmeier is a freelance writer and editor with more than 10 years covering IT. Formerly the openSUSE Community Manager for Novell, Brockmeier has written for Linux Magazine, Sys Admin, Linux Pro Magazine, IBM developerWorks, Linux.com, CIO.com, Linux Weekly News, ZDNet, and many other publications. You can reach Zonker at jzb@zonker.net and follow him on Twitter.

Follow ServerWatch on Twitter

This article was originally published on Oct 18, 2010
Page 1 of 1

Thanks for your registration, follow us on our social networks to keep up-to-date