Contents

xsel for buffer

Contents

Install package to save file context into clipboard buffers:

1
sudo apt install xsel

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

1
cat /etc/hosts | xsel -ip

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

1
cat /etc/hosts | xsel -is

xsel -x - Exchange the PRIMARY and SECONDARY selections

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

1
cat /etc/hosts | xsel -ib

From man:

1
2
3
4
Selection options
-p, --primary         Operate on the PRIMARY selection (default)
-s, --secondary       Operate on the SECONDARY selection
-b, --clipboard       Operate on the CLIPBOARD selection