Re: screen: cut and paste

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Does anyone know how to cut and paste with screen?

Unless you've changed the default escape-key from control+A or remapped the keys for doing the copy/paste, you use

  control+A  left-square-bracket ("[")

to start "copy mode". Within this, you can use most vi-key motions (and perhaps the arrows too) to move to the place you want to start your copy. Press <space> to mark the beginning of the block to be copied. Move the cursor to the end of the block you want to copy and press <space> again to mark the end of the selection. Screen will report back something like "18 characters copied".

You can then use

  control+A right-square-bracket ("]")

to paste the text as if you typed it. At any point after you've entered copy/scroll-back mode, you can use control+C to leave without copying.

And can it cut say a document in lynx that spreads over 3 pages?

You can copy/paste each page individually, copy each page appending to the internal clipboard, or if the text fits in less than the scroll-back buffer in Screen, then you can dump the page (optionally slicing out what you need) to the screen and then use the scroll-back buffer to pull it out.

Option #1 is a pain, but very easy to use/remember.

Option #2 is a more obscure feature that, while in copy mode, if you press "a", it will append-to rather than overwrite the existing clipboard, so you can select text on one page, copy it, scroll forward in Lynx to the next page, select the text on that page, press "a", then copy it, and repeat the "scroll, select, 'a', copy" loop for each page that you want. Then you have it all in one paste. However, if you forget to press "a" just one time, you tromp over all your previous work.

Option #3 is nice if there's a large swath of data you want to select and it fits within your scroll-back history:

  lynx -dump http://example.net | sed -n "20,36p"

to print lines 20-36 of the output from the specified webpage. You can skip the "sed" sub-process if you just want the whole document. This will act just like "cat" would have, dumping the text, which is then available in the scroll-back. I believe the default scroll-back history is 100 lines, but this can be changed by using the "defscrollback" setting in your .screenrc, using "scrollback" from the screen command-prompt, or the "-h" parameter for a given window. Thus, if you knew you wanted to pull out 1000 lines instead of 10, you could start a new screen session like

  screen
  [do stuff]
  screen -h 1000
  [in a new session with a bigger scrollback]
  lynx -dump http://example.com
  [do your copy/paste]

As yet another alternative outside of screen, Lynx offers a "p"rint option/command that you can use to dump the formatted text to a file for later editing/review with your favorite editor/pager program.

Hope this helps,

-tim





_______________________________________________
Blinux-list mailing list
Blinux-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/blinux-list

[Index of Archives]     [Linux Speakup]     [Fedora]     [Linux Kernel]     [Yosemite News]     [Big List of Linux Books]