LinuxCommandLibrary
GitHubF-DroidGoogle Play Store

xsel

Manipulate X11 clipboard selections

TLDR

Copy to clipboard
$ echo 123 | xsel -ib
copy
Copy file to clipboard
$ cat [path/to/file] | xsel -ib
copy
Output clipboard
$ xsel -ob
copy
Output to file
$ xsel -ob > [path/to/file]
copy
Clear clipboard
$ xsel -cb
copy
Output primary selection
$ 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

INSTALL

sudo apt install xsel
copy
sudo dnf install xsel
copy
sudo pacman -S xsel
copy
sudo apk add xsel
copy
sudo zypper install xsel
copy
brew install xsel
copy
nix profile install nixpkgs#xsel
copy

CAVEATS

X11 only. Content may be lost when X server restarts. Use wl-copy/wl-paste for Wayland.

SEE ALSO

xclip(1), wl-copy(1), wl-paste(1)

Copied to clipboard
Kai