When using GNU Screen we can work with scrollback buffer also known as "copy mode" using the Ctrl+a+[
command.
In there we can copy text to the copy buffer by pressing space
selecting the text and pressing space
again.
Is there some way to copy this text from screen copy buffer to the X clipboard?
In my case I'm using Ubuntu 12.04 with gnome and Xorg.
You can use a CLI clipboard tool like xsel
or pbpaste
and the cat
utility to grab contents from STDIN. The steps on Linux with xsel
are as follows:
cat | xsel -b
xsel
didn't report any error, now dump screen's copy buffer to STDIN: Ctrl+a+]
cat
to terminate it: Ctrl+d
At this point, the contents of the screen copy buffer should be in your clipboard.
EDIT: As with all X programs, xsel
needs to know how to contact your X server in order to access the clipboard. You should have your DISPLAY
environment variable set appropriately.