To have a peak productivity at working with command line most often you need multiple terminals open at a given time. One where you have your text editor session open, one where you read documentation, the third where you test out program snippets, etc. You might be pretty productive on a terminal emulator which can have multiple terminals open in a single window but what if you are connected to a distant server with a telnet/ssh client such as Putty? Would you run multiple Putty sessions to do what you have desired? What if your connection breaks loose? Would you reconnect and start all over again? Definitely not!

One of the solutions is to use an advanced terminal emulator such as screen.

What is screen (from GNU screen manual)?

Screen is a full-screen window manager that multiplexes a physical terminal between several processes, typically interactive shells. There is a scrollback history buffer for each virtual terminal and a copy-and-paste mechanism that allows the user to move text regions between windows. When screen is called, it creates a single window with a shell in it (or the specified command) and then gets out of your way so that you can use the program as you normally would. Then, at any time, you can create new (full-screen) windows with other programs in them (including more shells), kill the current window, view a list of the active windows, turn output logging on and off, copy text between windows, view the scrollback history, switch between windows, etc. All windows run their programs completely independent of each other. Programs continue to run when their window is currently not visible and even when the whole screen session is detached from the users terminal. Each virtual terminal provides the functions of the DEC VT100 terminal and, in addition, several control functions from the ANSI X3.64 (ISO 6429) and ISO 2022 standards (e.g., insert/delete line and support for multiple character sets).

When I first found screen, I didn't know many of its features. I knew I could create new terminals by pressing the default CONTROL-a-c key sequence and switch between them using the CONTROL-a-a sequence, that it would "save" my windows if I got disconnected and I could get them back by typing "screen -r" after I connected back to the computer. Not much else. I clearly wasn't as productive as I could have. I set out to explore the whole screen program.

To do that I used my cheat-sheet approach. As I have written before this approach is to have a printed cheat sheet in front of me as I learn new commands. This way each time I look for a command I can scan over the other commands and I can remember them better subconsciously.

This cheat sheet summarizes all they default keyboard mappings, with screen's commands to execute the mapping and a description of each mapping.

I had made this cheat sheet in the year 2001 and I had lost the file so I recreated it in LaTeX, made a PDF and converted it to .txt formats.

Actually I hadn't used LaTeX much and had difficulties to get it right the first time. I searched my documents collection and found The Not So Short Introduction to LaTeX book. Really nice reading. I recommend it!

Here is an example screenshot of how I use screen effectively:

screen - terminal emulator - split windows, named tabs, date, load

For more cool screen screenshots, Google search Google Images for 'gnu screen'.

Here is the cheat sheet itself:

Download Screen Cheat Sheet

PDF format (.pdf):
Download link: screen cheat sheet (.pdf)
Downloaded: 184064 times

ASCII .txt format:
Download link: screen cheat sheet (.txt)
Downloaded: 26026 times

LaTeX format (.tex):
Download link: screen cheat sheet (.tex)
Downloaded: 10064 times

Have fun becoming more efficient with screen!


lbjay Permalink
October 18, 2007, 22:17

Thanks for the cheat sheet. I've been using screen for years without really "mastering" it. Fortunately even just knowing the bare minimum is a huge productivity boost.

I'm wondering if you use a souped up .screenrc file and if so would you share it?

November 15, 2007, 20:20

This is proving to be very useful for me. The only drawback I am facing is that I can't scroll up the screens for looking at the long outputs. Any suggestions?

November 15, 2007, 22:18

Ankush, yes! Hit "Ctrl-a ESC", then use Ctrl-u to navigate half-screen up, Ctrl-d to navigate half-screen down, and you can use some key combinations from vim to navigate even more faster (like keys hjkl, slash / to search text forward or ? to search backward).

November 20, 2007, 19:10

Thanks!! this is working like a charm now :)

March 04, 2008, 21:10

fFjKkH hi nice site man thx

August 29, 2008, 00:33

You are also using splits in your screen screenshot!

For a detailed description on how to use vertical/horizontal splits I have taken some time to write this:
I hope someone finds it useful.

At the bottom of the link I gave, section 10) treats the vertical/horizontal splits.

Nice post :)

billy Permalink
September 03, 2008, 10:12

Is there a .screenrc for the "Here is an example screenshot of how I use screen effectively" picture in the article?

Anonymous Permalink
December 30, 2008, 07:25

This is a Good information, a good cheat sheet. Thanks very much.

June 26, 2010, 19:44

I can't live without screen, even if I had tmux it just wouldn't be the same. One of the most useful aspects of screen for me is the automation. I noticed that ctrl-a/w doesn't allow for seeking window title names, but if you detatch screen and use screen -p /title name/ it can save a few seconds of eye balling the list. I've found other automation things useful and documented them here

screen automation

I hope this is useful to other people too...

July 16, 2013, 09:47

Very useful. Thanks for that.

Henrik Permalink
November 04, 2013, 08:49

Thanks alot, very handy and keep up the good work :)

Leave a new comment

(why do I need your e-mail?)

(Your twitter handle, if you have one.)

Type the word "cdrom_32": (just to make sure you're a human)

Please preview the comment before submitting to make sure it's OK.