Recent Changes - Search:

Softwares

.

GNU-Screen

GNU Screen terminal emulation


DESCRIPTION

Screen is a full-screen window manager that multiplexes a physical terminal between several processes (typically interactive shells).

SYNOPSIS

       screen [ -options ] [ cmd [ args ] ]
       screen -r [[pid.]tty[.host]]
       screen -r sessionowner/[[pid.]tty[.host]]
  • You need to have screen installed check for. /usr/bin/screen
  • Install if not found. yum install screen
  • When screen is called, it creates a single window with a shell.
  • By default, each command begins with a control-a (abbreviated C-a from now on), and is followed by one other keystroke.
  • The standard way to create a new window is to type "C-a c" where C= ctrl key

Getting Started with screen for the first time.

Step 1 create fresh screen session:

screen -S <Yourname>

-S sessionname

When creating a new session, this option can be used to specify a meaningful name for the session.

This name identifies the session for "screen -list" and "screen -r" actions. It substitutes the default [tty.host] suffix.

The first window (the one you're actually using) is numbered as 0, while future windows will be labeled as 1, 2, 3 etc.

Step 2 create a new window.

Ctrl+a and then press c (create).

  • Press Ctrl+a, then n to switch to next window and Ctrl+a, then n to switch to the previous one.

List the window created.

  • Press Ctrl+a, and then Shift+" to see the list.
  • Press Ctrl+a, then a number from 0 to 9, to switch to the corresponding window.

Step 3 To detach from this session, press

Ctrl+a d.

Step 4 To kill not responding programs, use

Ctrl+a K.

Step 5 To see the screen sessions created.

screen -list

Step 6 To re-attach to a detached session, open a terminal and type.

screen -r <session>

Step 7 Sharing a screen session

  • Set the screen binary setuid root.

chmod +s /usr/bin/screen

  • Login as root and then type.

screen -S sessionName

  • Enable screen's multi-user access function by pressing Ctrl+a then :multiuser on (to type ":", press "shift+;")
  • Grant permissions to the second user by pressing

Ctrl+a: acladd username, where username is the Unix user for the second user.

  • User can now connect.

screen -x sessionName

Step 8 To scroll back through screen's history.

  • Enable the copy mode by pressing Ctrl+a [
  • Now, use either one of the arrow keys, page up, page down, home and end keys to scroll through screen's history.
  • Pressing Enter will start marking text for copying.
  • Pressing Enter again will copy the selected text into the clipboard. Now, to paste that text, press Ctrl+a ].

Step 9 To split the screen in two

  • First create two screen sessions.
  • Press Ctrl+a S which will split the screen in half.
  • To move to the bottom half, press Ctrl+a, then the TAB key.
  • Next press Ctrl+a, then " (shift+'). You will be presented with a list of available screen sessions
  • To Go back before the split press Ctrl+a Q.

Step 10 Help within Screen.

  • Ctrl+a ? shows the key bindings
Screen key bindings, page 1 of 2.

                       Command key:  ^A   Literal ^A:  a

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

^]  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 .

Step 11 Help from command help.

Use: screen [-opts] [cmd [args]]
 or: screen -r [host.tty]

Options:
-a            Force all capabilities into each window's termcap.
-A -[r|R]     Adapt all windows to the new display width & height.
-c file       Read configuration file instead of '.screenrc'.
-d (-r)       Detach the elsewhere running screen (and reattach here).
-dmS name     Start as daemon: Screen session in detached mode.
-D (-r)       Detach and logout remote (and reattach here).
-D -RR        Do whatever is needed to get a screen session.
-e xy         Change command characters.
-f            Flow control on, -fn = off, -fa = auto.
-h lines      Set the size of the scrollback history buffer.
-i            Interrupt output sooner when flow control is on.
-l            Login mode on (update /var/run/utmp), -ln = off.
-list         or -ls. Do nothing, just list our SockDir.
-L            Turn on output logging.
-m            ignore $STY variable, do create a new screen session.
-O            Choose optimal output rather than exact vt100 emulation.
-p window     Preselect the named window if it exists.
-q            Quiet startup. Exits with non-zero return code if unsuccessful.
-r            Reattach to a detached screen process.
-R            Reattach if possible, otherwise start a new session.
-s shell      Shell to execute rather than $SHELL.
-S sockname   Name this session <pid>.sockname instead of <pid>.<tty>.<host>.
-t title      Set title. (window's name).
-T term       Use term as $TERM for windows, rather than "screen".
-U            Tell screen to use UTF-8 encoding.
-v            Print "Screen version 4.00.02 (FAU) 5-Dec-03".
-wipe         Do nothing, just clean up SockDir.
-x            Attach to a not detached screen. (Multi display mode).
-X            Execute <cmd> as a screen command in the specified session.


Edit - History - Print - Recent Changes - Search
Page last modified on December 04, 2012, at 05:38 PM