xsel for buffer
Install package to save file context into clipboard buffers:
sudo apt install xselTo save in the primary (to paste: Shift + Insert, xsel -po):
cat /etc/hosts | xsel -ipTo save in the secondary (to paste: xsel -so)
cat /etc/hosts | xsel -isxsel -x - Exchange the PRIMARY and SECONDARY selections
To save in the clipboard (to paste: Ctrl + V, xsel -bo)
cat /etc/hosts | xsel -ibFrom man:
Selection options -p, --primary Operate on the PRIMARY selection (default) -s, --secondary Operate on the SECONDARY selection -b, --clipboard Operate on the CLIPBOARD selection