Change GNU Screen Keyboard Command

I changed the command character for screen from Control-a to Control-b recently, after switching to a wireless Mac keyboard. On this small, portable keyboard—which is the same layout as most Mac laptops—there’s only one Control key, and it’s on the left side of the keyboard.

The weird angle to hit Control-a was hurting my hand. Gone now is the left-side contortion I was forced to make to strike with my pinky and ring finger.

It’s pretty easy to change the command key mapping, just add escape ^Bb to your screen config file (usually located in your home directory). Here’s what my .shellrc looks like:

# Make the shell in every window as your login shell
shell -$SHELL

# Instead of Control-a, make the escape/command character be Control-b
escape ^Bb

# Autodetach session on hangup instead of terminating screen completely
autodetach on

# Turn off the splash screen
startup_message off

# Use a 100000-line scrollback buffer
defscrollback 100000

AUTHOR & TAGS

8 responses to “Change GNU Screen Keyboard Command”

  1. face Avatar
    face

    so, ‘screen’ vs. a multi-window terminal application (or tabbed terminal interface)?

    Like

    1. Lance Willett Avatar

      I use screen in remote shells a lot, because it maintains my session even if I get disconnected. I use it locally, too, to keep my tabs/windows to a minimum.

      Like

  2. Lloyd Dewolf Avatar

    One of the 1st things I do no setting up a mac, is switch Control and Command. I have no idea how people can press Command+c.

    Like

    1. Lance Willett Avatar

      It’s an easy keystroke combination in Dvorak. 🙂

      Like

      1. Lloyd Dewolf Avatar

        That can’t be it, that accounts for 0.0000000000000000000001% of Mac users 😉

        Like

      2. Lance Willett Avatar

        Naturally, though, 15.3% of Automattic.

        Like

  3. Lance Willett Avatar

    I should also note: switching to Ctrl-b allows using emacs Ctrl-a binding for moving to the beginning of a line.

    Like

    1. Lloyd Dewolf Avatar

      A reminder of more Mac insanity with Esc to Option not on by default in Terminal.

      It contributed to me becoming more comfortable with set -o vi.

      Like

Leave a comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.