Matt/ knowledge/ screen

This is my page summarizing the different things I've learned about screen. Most of it, as much as possible, is copied from other sources, which will be linked at the bottom of this article. This page has a slightly Mac/Linux slant, since that's what I use at home and work.

This is not a tutorial. This is for using extra features in screen, and organizing a place to remember how to do those things.

If you can't find what you're looking for here, try the keystroke index in the user's manual.

Quick Summary

C-a ? - Show key bindings

Window/Region Management

C-a N - Jump to #N screen in stack
C-a " - Full window list
C-a m - Toggle monitoring for activity
C-a ; - Toggle monitoring for silence
C-a S - Split window
C-a <tab> - Select next split window region
C-a + - Increase region size
C-a -  - Decrease region size
C-a X - Remove current region
C-a Q - Remove all regions except current
C-a i - Display window information

Text management

C-a [ OR C-a <esc> - Enter copy mode (use <enter> to set first mark and again to finish mark)
C-a ] - Paste copied text
C-u - Scroll up, also <page up> for faster scrolling
C-d - Scroll down, also <page down> for faster scrolling
C-a C - Clear the screen

.screenrc and entering commands directly

C-a : - Allows you to enter .screenrc commands while screen is running
altscreen on|off - Wipes the screen after programs like Vim exit (and leave cruft on the screen)
vbell on|off - Visual bell control
defscrollback # - Control the number of scroll-back lines in screen

Debugging why screen isn't working quite right

Use the command "dinfo" to get screen to tell you what it knows about your terminal.

Useful links

'Fixing' screen on Ubuntu/Debian

Screen seems to misbehave (try and backspace and you get "wuff wuff") when you startup screen, so people have recommended the following :

TERM=screen; screen

Then, alias that to the screen command and you should be done. It's hackery, but it works.

There's a section in the screen docs on how screen selects it's termcap info, and it's usually by finding a file that named "screen.${TERM}" (replacing TERM, of course). I've found that simply forcing your term to 'xterm' works on Ubuntu.

A more detailed explanation is here.

Explanation of hardstatus codes

Stolen from here, Copyright Brad Sims

Ignore the ' marks if you use these examples for yourself.

Note the embeded space after the colon, I feel it just looks nicer with a blank between the text and console edge:

'%{=b}%{G} Screens: '

This prints the window listing in blue:

'%{b}%w'

This right-aligns what follows:

'%='

This displays the time (hours and minutes) in 12hr format and adds an AM/PM flag, in bold green:

'%{G}%C%A'

This displays the day of the week:

'%D'

This displays the date in Mon/day/year format and again I embeded a space to give me one space between the text and console edge:

'%M/%d/%Y '

The resulting command give you a status line that looks like this:

| Screens: 0* bash  <blanks zapped>         5:30PM  Fri, Jun/25/2004 |

(The pipes indicate the edges of the xterm/console).

Green text, time, and date; windows in blue:

hardstatus alwayslastline "%{=b}%{G} Screen(s): %{b}%w %=%{kG}%C%A  %D, %M/%d/%Y "

Binding F-keys

Use bind -k k# in your screenrc file to set commands for the F## keys.

Sources