How To Install Xclip?

How To Install Xclip?

xclip

X11 clipboard manipulation tool, similar to `xsel`.
Handles the X primary and secondary selections, plus the system clipboard (`Ctrl + C`/`Ctrl + V`).

Maintainer: Alessandro Ghedini



Section: x11

Install xclip

  • Debian apt-get install xclip Click to copy
  • Ubuntu apt-get install xclip Click to copy
  • Alpine OS apk add xclip Click to copy
  • Arch Linux pacman -S xclip Click to copy
  • Kali Linux apt-get install xclip Click to copy
  • Fedora dnf install xclip Click to copy
  • Raspbian apt-get install xclip Click to copy
  • macOS brew install xclip Click to copy

X11 clipboard manipulation tool, similar to `xsel`. Handles the X primary and secondary selections, plus the system clipboard (`Ctrl + C`/`Ctrl + V`).

How to use xclip?

Below are few example commands for xclip that you can use in the terminal.

Copy the output from a command to the X11 primary selection area (clipboard):
echo 123 | xclipClick to copy
Copy the output from a command to a given X11 selection area:
echo 123 | xclip -selection primary|secondary|clipboardClick to copy
Copy the contents of a file to the system clipboard, using short notation:
echo 123 | xclip -sel clipClick to copy
Copy the contents of a file into the system clipboard:
xclip -sel clip input_file.txtClick to copy
Paste the contents of the X11 primary selection area to the console:
xclip -oClick to copy
Paste the contents of the system clipboard to the console:
xclip -o -sel clipClick to copy
Paste the contents of the system clipboard into a file:
xclip -o -sel clip > output_file.txtClick to copy
Installing xclip command is simple. just copy one of the above commands for your operating system and paste it into terminal. This command is available for Debian, Ubuntu, Alpine, Arch, Kali, Fedora, Raspbian and macOS operating systems. Once you run the command it will install the latest version of xclip 2026 package in your OS.