ARTICLE

GNU Screen - the ASCII window manager
Contributed by Girish Venkatachalam in Applications on 2007-04-12 11:16:56

GNU Screen or screen in short is something I discovered late in my UNIXromance. Now that I have got hooked to it there is no going back. One ofthe first packages I install on any linux distro is this marvellouscreation. Let us take a dekko at this and see what makes it soversatile.

It is a window manager you can run without having to run X window. And you can run this from inside an xterm too of course. But for most folkswho have used screen for some time forget that it is some kind of a window manager like windowmaker or fluxbox.

Instead it comes across as a powerful tool for collaboration for instance. Using screen, it is possible for a remote user to view the commands you are typing in real time. He gets a remote display a la vnc.Of course it goes without saying how useful this can be in debugging problems and in handling support calls.

But that is just the tip of the iceberg. There are so many other niceties. It is a wonderful way to seamlessly save sessions on a remote machine in case your local machine gets rebooted or hung. Sessions arenot written to disk but can always be retrieved from main memory.

GNU Screen has a copy/paste facility without using a mouse. It has screen dump facility, history mechanism and so on. This comes as a great boon to command line junkies like me.

It can be locked easily and detached and re attached at will. Either as a multi display mode or single display.

And it displays what you want it to show in the status line on the bottom of the screen. For instance, my ~/.screenrc has

shell -${SHELL}
caption always "%n(%t) : %C"

This displays the screen number, the title in brackets and the current time. I find this adequate for my needs. You can write one to suit your taste.

You can either suspend and resume individual processes (including the shell) from inside of screen or suspend the entire screen itself.All screen command sequences start with Ctrl-A. So what to do if you wish to enter Ctrl-A to move to the beginning of the line in bash?

You type "Ctrl-A A" and voila! Screen passes it as Ctrl-A to bash.

In fact most hairy debugging and logging problems are elagantly solvedthe moment you put screen in picture.

I hope at least you discover the magic of screen early in your UNIX career...