2 ways to change key binding in “screen”

The unix program screen, by default, uses Ctrl-a as the key binding as the command character. This conflicts with my use of Ctrl-a to go to the beginning of line. Often I find myself pressing Ctrl-a Ctrl-d intending to go to the beginning of the line and delete some characters. However, this ends up detaching my screen session as Ctrl-a Ctrl-d is used to detach the existing screen. Needless to say that this got very annoying very quickly.

Screen gives you an easy way to change the command character from Ctrl-a to something else , say Ctrl-t.

Option 1

Add this entry to ~/.screenrc:

escape ^tt

You would almost always want this option because once you have added the setting to your screenrc file, it will work consistently on your machine and don’t have to remember to set it each time.

Option 2

Invoke screen with the -e option, like this:

screen -e^tt

This option is particularly useful in two cases:

  • If you are using a shared environment and don’t want change the default key binding
  • If you are attaching a detached session, and the detached session had a different key binding. Note that the detached session does not reload the .screenrc, so in that case this is the only option that you can use.
screen -e^tt -r

No related posts.

Leave a Reply




You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Get Adobe Flash playerPlugin by wpburn.com wordpress themes