xclip
xclip is a command line utility for accessing X server selections (clipboard) on X11 systems. It reads data from stdin or files to place in X selections or prints selections to stdout.
Description
xclip provides a command line interface to X selections, known as the clipboard, on systems with X11 implementations. It enables users to read data from standard input or files and place it into an X selection for pasting into other X applications. Conversely, it can print an X selection to standard output, allowing redirection to files or other programs.
This tool is particularly useful for scripting clipboard operations in terminal environments, facilitating seamless data transfer between command line processes and graphical X applications. The xclip package also includes companion tools like xclip-copyfile, xclip-cutfile, and xclip-pastefile for file operations via the X clipboard.
Installed size is 62 KB, with dependencies including libc6, libx11-6, libxmu6, and xclip itself.
How It Works
xclip interfaces directly with the X11 server to read from or write to X selections such as 'primary', 'secondary', 'clipboard', or 'buffer-cut'. It connects to a specified X display, handles selection requests with configurable loops, and processes data via stdin/stdout or files, leveraging X11 protocols for clipboard operations.
Installation
sudo apt install xclipFlags
Examples
xclip -hxclip -ixclip -oxclip -d localhost:0xclip -selection clipboardxclip-copyfile --helpxclip-pastefile -h