Follow me on Twitter for my latest adventures!
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:

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: 100896 times
ASCII .txt format:
Download link: screen cheat sheet (.txt)
Downloaded: 17829 times
LaTeX format (.tex):
Download link: screen cheat sheet (.tex)
Downloaded: 3334 times
Have fun becoming more efficient with screen!


Facebook
Plurk
more
GitHub
LinkedIn
FriendFeed
Google Plus
Amazon wish list
Comments
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?
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?
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).
Thanks!! this is working like a charm now :)
fFjKkH hi nice site man thx http://peace.com
thx for info
very useful
loved it
article is a great resource
command lines make the world go around.
excellent post, well researched
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:
http://code.google.com/p/perlhobby/wiki/scripts
I hope someone finds it useful.
At the bottom of the link I gave, section 10) treats the vertical/horizontal splits.
Nice post :)
Is there a .screenrc for the "Here is an example screenshot of how I use screen effectively" picture in the article?
awesome quote up top
good reference information
This is a Good information, a good cheat sheet. Thanks very much.
Enjoyed the read, will bookmark.
why do some post have [...] infront and after them?
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...
Leave a new comment