xsel for buffer

Install package to save file context into clipboard buffers:

sudo apt install xsel

To save in the primary (to paste: Shift + Insert, xsel -po):

cat /etc/hosts | xsel -ip

To save in the secondary (to paste: xsel -so)

cat /etc/hosts | xsel -is

xsel -x - Exchange the PRIMARY and SECONDARY selections

To save in the clipboard (to paste: Ctrl + V, xsel -bo)

cat /etc/hosts | xsel -ib

From 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