
Screen, an Introduction
A very nice little program for you power Linux users is Screen. To quote from the website, "Screen is a full-screen window manager that multiplexes a physical terminal between several processes, typically interactive shells." Well, isn't that a mouthful! More simply, Screen lets you open several terminals at once, each running whichever program you want.
___
Notations: Commands which may or may not be necessary for you will be placed in { }s. For commands in quotes, remove the quotes when employing. Assumption is a Debian-based distribution for the install instructions.
___
Some people live in their GUI world of Gnome and KDE, rarely, if ever, venturing into text-based computing when they open a terminal emulator window to complete some task. Then they scurry back to the mouse. Many, however, are not afraid of hitting {CTRL+} ALT+F1 to F6 to log into a calming, fast and efficient virtual console. For those brave souls there are some great tools available. Screen makes using many of them easier.
Before going any further, you should make sure Screen is installed on your Linux box. For that, you might as well pop out into a virtual console, say tty1, by typing CTRL+ALT+F1 from Xwindow. You can log in as root, or if you have SUDO, as yourself. Once in, type "{sudo} apt-get install screen" and hit enter. If not there, it will be installed, if it is, it will be confirmed. If you needed to be root, log out now and back in as yourself. Now you are ready to play.
At the prompt, type "screen" to launch the program. You should be presented with a bit of info about Screen. Just type space or enter to get rid of it. You will now see a nice fresh prompt that looks like the one you just had, except this one is within Screen. You can use this as you would any other.
In Screen, CTRL+a is a very important key combination. It tells Screen to get ready to accept a command. For example, to leave your newly created Screen terminal, with a program running you wish to return to later, type "CTRL+a d" to detach. "Screen -ls" or "Screen -list" will show you which Screen terminals you have running in the background. To reattach to it, simply type "screen -r" to recover it. Now you are right back where you were.
Now, remember that bit about multiplexing? Let's make another terminal session. Type "CTRL+a c" to create one. Need more? Just repeat the procedure. You can leave one alone for commands, start IRC in another, have Mutt ready for mail in one, keep Aptitude on stand-by, or whatever. Use "CTRL+a" and the numbers 0 to 9 to pick one in particular, or use "CTRL+a n" for next and "CTRL+a p" for previous. Not sure how many you have running? Type "CTRL+a "", that's double quotes, for a list. You can scroll up and down with your arrow keys to select one, and hit enter to display it.
Looking at the list is not very helpful if they are all called "bash", so lets give them a title. To do that, just type "CTRL+a A" while in the terminal you want nAmed, backspace over the old name, and type in the new one. Now when you bring up your list, you can see what is what, if you labeled them that way. When you are done with a terminal, "CTRL+a k" will shut it down.
Abridged Screen Command Summary
- screen: starts Screen
- screen -ls or -list: list open Screen sessions
- screen -r: recovers a screen session
- CTRL+a: escape key, gets Screen's attention
- CTRL+a d: detach a Screen session
- CTRL+a c: create another Screen terminal
- CTRL+a k: kill or close a terminal
- CTRL+a 0 to 9/q to p: display terminal number 0 to 19
- CTRL+a n or spacebar: display the next terminal
- CTRL+a p: display the previous terminal
- CTRL+a A: rename a terminal
- CTRL+a ": list all running Screen terminals
This should get you started at using Screen. Stay tuned for another article showing more advanced features, and how it is great teamed up with SSH.
(DISCLAIMER: I have only been using Screen for a few days myself, so I'm far from an expert. If you can offer any additions, corrections, hints or tips, please add them as a comment below.)

Ok I think i'm starting to
Ok I think i'm starting to get it. Now I have to try this out! Thanks for the article Pete!
great tutorial
Great tutorial, thanks a lot for it. I'm linking to this from my site, too.