If you’ve read my brief tutorial on screen and want to know more, here are some power user tips:
screen -ls will list the current screen sessions running on a machine.
Control-a Control-a will toggle between your current shell and your previous shell.
Control-a d will detach a session.
Control-a ” will show all the current shells. Use the up/down cursor keys and then press enter to select a shell.
Those commands will help you navigate the windows within a session.
In most Linux terminals, Control-a takes you to the beginning of your line. Suppose you want to keep that behavior? Luckily it’s easy to bind screen’s “escape” key to something other than Control-a. You can modify screen’s settings by creating a ~/.screenrc file in your home directory. Here’s what my .screenrc file looks like:
escape ^Bb # Instead of Control-a, make the escape/command character be Control-b
autodetach on # Autodetach session on hangup instead of terminating screen completely
startup_message off # Turn off the splash screen
defscrollback 30000 # Use a 30000-line scrollback buffer
termcapinfo xterm ti@:te@
# From http://www4.informatik.uni-erlangen.de/~jnweiger/screen-faq.html
# Q: My xterm scrollbar does not work with screen.
# A: The problem is that xterm will not allow scrolling if the alternate text buffer is selected. The standard definitions of the termcap initialize capabilities ti and te switch to and from the alternate text buffer. (The scrollbar also does not work when you start e.g. ‘vi’). You can tell screen not to use these initialisations by adding the line “termcapinfo xterm ti@:te@” to your ~/.screenrc file.
Most of these settings are pretty self-explanatory. Anyway, that’s how I set-up my screen. 🙂