A short Tutorial for screen: ============================ I will use the uppercase letter 'C' als shortcut for the Keyboard [Control] starting screen: screen (normal startup) screen -r [name|pid] (attach screen with or ) screen -S (start new screen and give socket-) screen -d [name|pid] (dettach an attaches screen, useful if your move from your Home to University and forgot to detached at home :-) screen -p (attach screen with window-name if exists) screen -ls (show running screens, but don't attach anyone) screen -h (number of scrollback buffer in num lines) screen -e ^Ba (changes the default C-a to C-b, you have to press 'screen -e [Ctrl]+V [CTRL+b] in your shell) screen -A -r (resize window on attaching to fit terminal, eg. xterm, width) handling screen: C-a,d (detaches screen, d=detach) C-a,c (creates new screen window, c=create) C-a,k (kills current window, if your are in a $SHELL simple type 'exit' or C-d) C-a,n (moves to next screen window) C-a,p (moves to previous screen window) C-a,N (N is a number from 0 to 9, to switch to the corresponding window) C-a," (get a full-screen list of windows. navigate with arrow keys or vi-style. pick a window to activate by pressing Enter.) C-a,w (Same as C-a," only short display in footer) C-a,A (set window title name) C-a,' (switch to window name) C-a,x (lock screen, enter password to work again) C-a,h (make a hardcopy of the actual screen-window) C-a,H (enable/disable actual screen-window logging) C-a,t ('uptime' like info info at the status line) C-a,m (repeat last screen-message in status line) C-a,? (shows key bindings) C-a,C (clears the screen and saves it contents to the scrollback buffer) C-a,l (redraws the current screen window) C-a,r (toogle, the line-wrap on/off) C-a,a (sends [Control]-[a] to terminal, usually jumps to begining of line) C-a,: (execute screen command - z.B. C-A:next) Monitor-Mode: C-a,M (start/stop monitor mode for the current window) C-a,_ (start/stop monitoring the current window for inactivity) C-a,C-G (toggle visual/audio bell) C-a,:idle (set idle action, ONLY screen >4.x) [editor-mode]copy/scroll-back: C-a,[ (enter the editor mode) C-a,] (paste the buffer to current commandline) (set start/end point of buffer) C-a,> (write buffer to exchange file) C-a,< (read exchange file into buffer) C-a,= (remove exchange buffer from filesystem) movements: C-u | C-d (scroll the display half up/down) C-b | C-f (scroll the display up/down a full screen, in some cases [PgUp][PgDn] works also) h, j, k, l (move Cursor. left,right,up,down) 0, $ (begining and end of line) H, L, M (move Cursor. top, bottom, centerd) +, - (line up and down) G (jumps to buffer end) g (jumps to begin of buffer) w,b,e (word forward, backward, end of word) Regions: C-a, S Split screen C-a, focus windows to navigate like vi-style add this to your screenrc (bind j focus down, bind k focus up, bind t focus top, bind b focus bottom) C-a, X kill the current region C-a, Q kill all regions but the current one. C-a, F change the window size to the size of the current region. resizing: (Enter command mode from screen 'C-a, :' and type ...) resize +N increase current region height by N resize -N decrease current region height by N resize N set current region height to N resize = make all windows equally high resize max maximize current region height resize min minimize current region height Multiuser Session: multiuser on|off disbales multiuser mode wall message write a message to all users. acladd usernames add's a user(s) name to allow to attach your screen [acladd user1,user2] aclchg usernames permbits list Change permissions for a comma separated list of users. permbits -/+(rwx) some examples: aclchg userA -w+w 2 [removes write ability to userA in window 2] aclchg userB -x "#" [removes executing rights for "#"(wall windows) on userB] aclchg * -r 3 [removes all user reading rights on window 3] C-a * show all connected users to your screen. example for editor mode: enter screen and generate some ouput. - press C-a,[ - move with cursor (or h,j,k,l) around - press space - move again with cursor (inverted characters are marked) - press space again (copies marked into buffer) - press C-a,] (buffer is copied to standard in, !BEWARE of pasting 'rm -rf /*' ) or/and - press C-a,> (buffer is written to file) - leave screen or start new screen in other window - press C-a,< (reads screen-xchange file into buffer) and - press C-a,= (removes buffer file) example for Monitor mode: enter screen - do 'touch foobar' 'tail -f foobar' - press C-a,M (activate Monitoring for actual window) - press C-a,c (for new window) - do 'echo "bla" >> foobar' (screen-message show activity in statusbar) - press C-a,1 (back to first window) - press C-a,M (deactivate Monitoring) - press C-a,2 (jump back to second window) - do 'echo "blub" >> foobar' (no screen message occurs) (try this with 'C-a,_' instead of 'C-a,M' and see what happens) example for multiuser Modus: userB can/should connect to a screen which has userA has startet. the commands 'multiuser on' and 'acladd userB' can also be placed into .screenrc - starts screen - C-a :multiuser on - C-a :acladd userB - userB enters 'screen -x userA/' and connects to the screen which userA hast startet. Tips&Tricks: -------------------- Bind Keys for window ---------------- bind ) select 10 bind ! select 11 bind @ select 12 bind \# select 13 bind \$ select 14 bind % select 15 bind \^ select 16 bind & select 17 bind * select 18 bind ) select 19 The default commands include Ctrl+a 5 to select screen 5; this makes Ctrl+a Shift+5 select screen 15. --------------------- some usefull startup things in .screenrc ----------------- # kill startup message startup_message off # turn logging on for all windows deflog on # define a bigger scrollback, default is 100 lines !greater Memory Usage! defscrollback 2300 # toogles the visiual bell vbell on # vbell message vbell_msg "*knock knock* - wake up neo!" # on Debian backspace should send char `177': bindkey -k kb stuff "177" # An alternative hardstatus to display a bar at the bottom listing the # windownames and highlighting the current windowname in blue. (This is only # enabled if there is no hardstatus setting for your terminal) hardstatus on hardstatus alwayslastline hardstatus string "%{.bW}%-w%{.gW}%n %t%{-}%+w %=%{..G} %H %{..Y} %m/%d %c% " # my old setting # hardstatus string "%{bk}%H%{wk}|%c> %?%-Lw%?%{kb}%n*%f %t%?(%u)%?%{wk}%?%+Lw%?" ------------------ Autostart Programms ------------------- # Example of automatically running some programs in windows on screen startup. # Use the form: screen [-flag] [window name] [window number] [program to run in window] # The -t flag means that the window in which that program is running # closes when you exit that program, so if you quit pine # window 2 closes. screen bash screen -t vim 1 vim filofax screen -t mail 2 mutt screen -t slashdot 3 links http://www.slashdot.org/ screen -t bar 4 ssh foo@bar