xsel
Manipulate X11 clipboard selections
TLDR
Copy to clipboard
$ echo 123 | xsel -ib
Copy file to clipboardcopy
$ cat [path/to/file] | xsel -ib
Output clipboardcopy
$ xsel -ob
Output to filecopy
$ xsel -ob > [path/to/file]
Clear clipboardcopy
$ xsel -cb
Output primary selectioncopy
$ xsel -op
copy
SYNOPSIS
xsel [OPTIONS]
DESCRIPTION
xsel manipulates X11 clipboard and selection buffers. It can read, write, clear, and exchange content between primary selection, secondary selection, and clipboard.Similar to xclip but with different syntax and additional features.
PARAMETERS
-i, --input
Read from stdin-o, --output
Write to stdout-c, --clear
Clear selection-b, --clipboard
Use clipboard selection (Ctrl+C/V)-p, --primary
Use primary selection (middle click)-s, --secondary
Use secondary selection-a, --append
Append to selection
CAVEATS
X11 only. Content may be lost when X server restarts. Use wl-copy/wl-paste for Wayland.