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:
- Copy text from your screen session into GNU screen's copy buffer.
- Run this command within screen:
cat | xsel -b
- If
xsel
didn't report any error, now dump screen's copy buffer to STDIN:Ctrl+a+]
- Send an EOF to
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.