X Clipboard – How to Operate X Clipboard from Command Line

clipboardcommand linex11

I'd like to copy and paste to the clipboard from the command line.

I've found two utilities that works with "mouse" selection: xclip and xsel. But they both ignore the clipboard that is filled with Ctrlc in GUI applications. So I may not paste things that were copied in this way.

What command line utility works like xclip or xsel but is compatible with Ctrlc and Ctrlv?

Best Answer

xclip uses the clipboard if you specify -selection clipboard:

xclip -selection clipboard -o

prints the contents of the clipboard (as filled with Ctrl-C in a GUI application).

The equivalent option for xsel is -b (or --clipboard).