User Tools

Site Tools


Using Screen

allow people to attach to my screen

| ~/.screenrc
multiuser on

allow the following people full control

addacl root,aledesma,mymanager,mycoworker1,mycoworker2
aclchg aledesma +rwx “#?”

allow everyone readonly access

aclchg *,!aledesma -rwx#?”

setup 10,000 lines of available scrollback — copy/paste

defscrollback 10000

fix scrollback in putty

termcapinfo xterm* ti@:te@

Entering Scrollback Mode and Navigating

To enter scrollback hit Ctrl+a [ . A status line will indicate that you've entered copy mode. To exit scrollback mode, hit the escape button.

Navigating in scrollback mode will be pretty familiar to VI users. Here are some of the most common navigation keys (taken from the screen manpage):

h -    Move the cursor left by one character
j -    Move the cursor down by one line
k -    Move the cursor up by one line
l -    Move the cursor right by one character
0 -    Move to the beginning of the current line
$ -    Move to the end of the current line.
G -    Moves to the specified line 
       (defaults to the end of the buffer).
C-u -  Scrolls a half page up.
C-b -  Scrolls a full page up.
C-d -  Scrolls a half page down.
C-f -  Scrolls the full page down.

I often use the page up and page down commands to quickly scroll back through the window's history.

In addition to traditional navigation, Screen allows you to search the scrollback buffer using the following commands:

/ -    Search forward
? -    Search backward

Search is a very useful feature. For example, you could run a script and search for keywords in the output (such as Error), without having to redirect the output.

Screen Profile

This is a decent screen profile I use on my machines.

| .screenrc
hardstatus alwayslastline "%H Screen(s): %{b}%w %=%{kG}%C%A  %D, %M/%d/%Y "
startup_message off
defscrollback 5000
msgwait 1
bindkey -k k1 select 1
bindkey -k k2 select 2
bindkey -k k3 select 3
bindkey -k k4 select 4
bindkey -k k5 screen
bindkey -k k6 title
bindkey -k k7 prev
bindkey -k k8 next
bindkey -k k9 detach
screen.txt · Last modified: 2020/08/10 02:35 (external edit)