Gnu Screen: Quicksilver (Kind Of) for Command Line Junkies

If you're a command line junkie, Gnu Screen command is a handy, handy application. It simulates multiple terminals from within one terminal using a relatively easy to learn array of keyboard shortcuts. For example, you can keep top running in one virtual terminal, vi in another, and a bash prompt in another. If you're an OS X user think of it as Quicksilver for the command line.

One annoyance I ran into, however, is the fact that by default screen uses the ctrl-a key to put it into command mode. Ctrl-a is used by default in readline to move the cursor to the beginning of a line and, as bash leverages readline, it's a keystroke that is very useful. Because of this keyboard mapping conflict, I found myself hitting ctrl-a to move the cursor to the beginning of the line and, instead, entering Screen's command mode. Frustrating.

One solution is to change the default keystroke that puts Screen into command mode. To configure screen to use the backtick, for example, add the following line to your .screenrc:

escape `a

An alternative to this method is remapping which bash keystroke moves the cursor to the beginning of the line. You can, for example, change this from ctrl-a to ctrl-b by adding the following line to your .bashrc file:

bind '"\C-b": beginning-of-line'

If you want screen to automatically start when you enter the command line, add the lines below to your ~/.bashrc file.

if [ $TERM != 'screen' ]; then
screen
else
echo 'Screen is activated.'
fi

6 comments on Gnu Screen: Quicksilver (Kind Of) for Command Line Junkies

  1. ghd (not verified)
    Mon, 2010-05-17 04:09

    GHD are popular in uk and us,welcome to buy a piece of GHD.

  2. ghd (not verified)
    Mon, 2010-05-17 04:08

    The top GHD are collected here, you will find GHD at our web.

  3. 出会いメル友セフレ (not verified)
    Sat, 2010-01-23 07:26
  4. LoiNT (not verified)
    Wed, 2009-10-21 18:04
  5. jeffry (not verified)
    Tue, 2009-10-20 10:13

    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, 640-801 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. MB2-631 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, 70-271 several control functions from the standards (e.g., insert/delete line and support for multiple character sets).

  6. Jimmy (not verified)
    Sun, 2008-09-28 20:29

    you can use C-a a in screen to go to the beginning of the line
    I prefer this b/c I'm too lazy to change the key bindings ;-)