Search notes:

xclip

xclip is the command line interface to clipboards (or selections?)

Fill clipboard

Fill clipboard with foo bar baz:
echo "foo bar baz" | xclip
Apparently, after filling the clipboard, the content can be pasted with the middle mouse click, not with ctrl-v, in some applications.

Print content

Print content of clipboard (-o stands for out):
xclip -o

Copy the content of a file with an image to the clipboard

xclip -i -selection clipboard -t image/png ~/images/foo.png

Getting the content of the clipboard with Python

>>> print(subprocess.check_output('xclip -o', shell=True).decode('utf8'))

See also

Perl module Clipboard
/dev/clipboard
The shell script pc copies the value of the current working directory into the clipboard.
wsl-screenshot-to-clipboard is used in a Windows Subsystem for Linux (WSL) environment to copy a screenshot made with SnippingTool.exe into the clipboard using xclip.
clip.exe on Windows.

Index