GNU screen

screen - screen manager with VT100/ANSI terminal emulation

screen is extremely helpful for long running programs or commands, e.g. backups. Once started in screen, you can safely detach from the session and reattach at any time. No termination of commands, no unintended cancelation of tasks.

You can split your screen into different shapes, run several programs in parallel and see their output side by side in one terminal window.

There is a lot more screen can do for you. I just raked together the basics to get started.

key bindings

                             Screen key bindings, page 1 of 1.

                             Command key:  ^A   Literal ^A:  a

break       ^B b       history     { }        other       ^A         split       S
clear       C          info        i          pow_break   B          suspend     ^Z z
colon       :          kill        K k        pow_detach  D          time        ^T t
copy        ^[ [       lastmsg     ^M m       prev        ^H ^P p ^? title       A
detach      ^D d       license     ,          quit        \          vbell       ^G
digraph     ^V         lockscreen  ^X x       readbuf     <          version     v
displays    *          log         H          redisplay   ^L l       width       W
dumptermcap .          login       L          remove      X          windows     ^W w
fit         F          meta        a          removebuf   =          wrap        ^R r
flow        ^F f       monitor     M          reset       Z          writebuf    >
focus       ^I         next        ^@ ^N sp n screen      ^C c       xoff        ^S s
hardcopy    h          number      N          select      '          xon         ^Q q
help        ?          only        Q          silence     _

^]   paste .
"    windowlist -b
-    select -
0    select 0
1    select 1
2    select 2
3    select 3
4    select 4
5    select 5
6    select 6
7    select 7
8    select 8
9    select 9
I    login on
O    login off
]    paste .
|    split -v
:kB: focus prev

… and translatetd into something readable (ctrl means control-key):

detachctrl a d
create new windowctrl a c
give a title to windowctrl a A
change to next windowctrl a n
change to previous windowctrl a p
show window listctrl a “
split display horizontallyctrl a S
split display verticallyctrl a |
jump to next display regionctrl a tab
remove current regionctrl a X
remove all regions but currentctrl a Q
monitor window for activityctrl a M
monitor window for inactivity/silencectrl a _
enable logginctrl a H

common tasks

Start a named session, give the first window a title and fire a bash login shell, so we have all the convenient stuff applied (.bash_login, .bash_profile, …)

screen -S <sessionname> -t <windowtitle> -s -/bin/bash

To detach from a session

screen -d <sessionname>

Reattach to a session:

screen -r
screen -r <sessionname>

List active sessions:

screen -list
There is a screen on:
        6802.pts-0.lisa (02.12.2013 14:09:24)   (Attached)
1 Socket in /var/run/screen/S-root.

configuration file

shell -/bin/bash
vbell off
hardstatus on
hardstatus alwayslastline
hardstatus string "%{.bW}%-w%{.rW}%n %t%{-}%+w %=%{..G} %H %{..Y} %C%a "

By default, screen is a non-login interactive shell. This means no .bash_* magic.
If you want screen to apply your .bash_login/.bash_profile settings,
you might add shell -/bin/bash to ~/.screenrc as shown above.

linux/screen.txt · Last modified: 2013-12 by tb
Driven by DokuWiki Recent changes RSS feed Valid CSS Valid XHTML 1.0 ipv6 ready