Screen is invaluable. The following documents some of the quick hacks I use to utilise screens full potential.
TERM Setting
Unix terminal programs depend on a reasonable $TERM variable being set. My specific issue is using emacs with windmove. I run emacs exclusively in the terminal, and windmove works as expected. However, running under screen breaks the use of the arrow keys.
Hitting shift-left results in `2D’ being sent to the terminal. There are a number of ways to fix this, the one the has the most consistent result (for me) is to correctly set the TERM variable. To do this I add an alias for screen.
alias screen="screen -T $TERM"
Now when ever I fire up screen it receives my current TERM and behaves as expected.
Command Key
The default command key is control-a which clashes with emacs as well as the shell in emacs mode. To change this, use the escape command in your .screenrc. I use control-\ as it does not clash with anything I use in emacs.
~/.screenrc:
escape ^\\\
Visual Bell
I use the terminal bell with XTerm*bellIsUrgent: true to send notifications via my window manager (xmonad). Screens default behaviour is to use a visual bell, bypassing this setting. To turn the visual bell off (enabling the standard behaviour) just add the following to your .screenrc.
~/.screenrc:
vbell off
Favourite Commands
There is a fairly large list of things that screen can do. However there are only three commands I run on a regular basis:
$ # List all screen sessions $ screen -ls $ $ # Detach and then re-attach to a screen session (creating it if necessary) $ screen -D -R screenname $ $ # Attach to a screen session, in sharing mode, awesome for remote pairing. $ screen -x username/screenname