Wednesday, March 4, 2015

Screen Dump


The other week J.K. at SFVlug was asking if I could provide some notes on the GNU 'screen' program. Here, extracted from some earlier notes, and beefed up with a few references I use, without further commentary, are the basic commands, hotkeys, and other data I need for most of my 'screen' use.




some screen notes:

Note: keep in mind screen can be run inside of xterm and other environments

to kill a range of screens:

for i in {3..13} ; do screen -p $i -X kill ; done

screen -h / --help     (of course)
there are or can be /etc/screenrc ~/.screenrc files
screen -ls    list screen sessions
screen -r    ####.tty##.        attach to detached screen
screen  -r -DD   violently try to grab or start a screen session
                   if none available  doing whatever it takes
ESC == ^A  normally (I usually redefine to ^O)
            Some people like ^@  (which results in ^ as ESC)
ESC-?  help 
ESC-d      detach (throw into background) current screen session
ESC-c      open another virtual console
ESC-k      kill the current virtual console (or you can just exit it)
ESC-t  show system info (including time/date by default)
ESC-:  open screen command prompt at bottom of console
               (can enter commands normally mapped to keys etc.)
                    ~ ':' ex-mode in vi or lynx, or w3m
ESC-p/n     previous / next virtual console, cycling through them
ESC-#       (#==0-9) select console  #
ESC-A       give virtual console a name (or view the current console name)
ESC-'       pull up prompt to give a virtual console # or name & then switch
ESC-"       pull up virtual console selection menu
ESC-[       put in copy / scroll mode
  in copy/scroll mode:
      ('.'   for  a register, is interpretted as the paste buffer )
      (~vi cursor movement)
      c / C   set left / right margins
       or  set a mark (first or second)
      W       grab word under cursor
      Y       mark whole line
      y       mark from start of line
      x       eXchange current cursor position and mark
      a       kick into append (to buffer) (instead of overwrite buffer ) mode
      A           "          *AND* set a mark
      J     cycle through join/join with spaces/join with commas/multiple lines
      |       move to absolute column       
      g       go to top of scroll buffer
  ESC-]      dump paste buffer to stdout
   
shared sessions with screen:
http://www.lowlevelmanager.com/search/label/pair%20programming
              (courtesey local Perl Mongers chief)
http://www.caikesouza.com/blog/category/linux/
(see article for permissions set up)

(for user foo:)
screen -S pairprog
^A :multiuser on
^A :acladd bar  

To make other read-only:
^A :aclchg bar -w "#"

(user bar:)
Then to join:
screen -x foo/pairprog

http://www.lafn.org/~aw585/gh.html
           - has some examples of setting up a text console 'desktop',
               and stuffing commands on startup into a program on startup
                 with screen

http://isthereanotherquestion.blogspot.com/2008/06/full-screen-ahead.html

some packages/programs to interact with screen (I don't use any of these):
iselect
screenie
byobu

Some similar programs:
tmux (~a ground up rewrite)
dvtm   (simpler, more tiling oriented)
splitvt   (very simple lite horizontal split)
fbterm    (requires frame buffer) 

-- Dallas E. Legan 2015 March 04

 

No comments: