Published on

Getting tab completion to work in screen


Once you understand the basics of how GNU screen works it makes your life easier on remote systems:

  • You do not need to login multiple times to have more than one shell
  • If the connection drops you can simply reattach to you screen session (I have used this trick as a quick and dirty daemon setup for whatever is running) which will bring back all shells
  • You can use your .screenrc file to make working on screen exactly as you want it

There are newer alternatives to screen but the reason I still stick with screen is many Unix/Linux distros (no matter how old) come with it out of the box or at the very least have them in their package repos.

One thing that really frustrates me with screen is how it does not have tab completion and many of the other bells and whistles you would normally expect from a shell. I found the solution to this, you need to define a .screenrc file where you tell screen to use a specific shell. For example to tell screen to use bash you need to define a .screenrc file in your ~ directory as follows:

defshell -bash

The next time you start screen by running the screen command you will have tab completion as well as whatever else you would expect from the given shell making working with screen much more pleasurable.