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:
PDF format (.pdf):
Download link: screen cheat sheet (.pdf)
Downloaded: 6775 times
ASCII .txt format:
Download link: screen cheat sheet (.txt)
Downloaded: 2753 times
LaTeX format (.tex):
Download link: screen cheat sheet (.tex)
Downloaded: 536 times
Have fun becoming more efficient with screen!
Did you like this post? Subscribe to my posts!

(9 votes, average: 4 out of 5)
|
|
|


October 11th, 2007 at 10:13 pm
[…] Tex MacRae: […]
October 18th, 2007 at 10:17 pm
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?
October 31st, 2007 at 3:41 am
[…] the cheat sheet for a while. My previous article on being more productive on the command line was screen’s cheat sheet which allows to emulate multiple terminals in a single window. You can take a look at it as well! […]
November 10th, 2007 at 10:42 pm
[…] VT-100/ANSI cheat sheet Filed under: Reference, Technology — 0ddn1x @ 2007-11-10 19:47:55 +0000 http://www.catonmat.net/blog/screen-terminal-emulator-cheat-sheet/ […]
November 15th, 2007 at 8:20 pm
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 15th, 2007 at 10:18 pm
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 20th, 2007 at 7:10 pm
Thanks!! this is working like a charm now
March 4th, 2008 at 9:10 pm
fFjKkH hi nice site man thx http://peace.com
March 13th, 2008 at 6:47 pm
[…] vi. Wer genau weis was alles möglich ist, vor dem ziehe ich meinen Hut. Ansonsten fand ich diese Kurzanleitung mit der Kommandoreferenz relativ […]
April 22nd, 2008 at 12:19 am
thx for info
April 25th, 2008 at 1:27 am
very useful
June 10th, 2008 at 11:09 pm
loved it
June 13th, 2008 at 4:29 am
article is a great resource
July 22nd, 2008 at 2:04 am
command lines make the world go around.
July 22nd, 2008 at 5:41 am
[…] Screen Terminal Emulator Cheat Sheet (downloaded 6′706 times) […]