Manipulate the X Clipboard from the Command Line

The key is the xclip program! To put text into the X clipboard (“copy”):

xclip -b <file.txt

To fetch the text from the X clipboard (“paste”):

xclip -b -o >file.txt

On Fedora, this requires installing the xsel package.