kitten-clipboard(1) | kitty | kitten-clipboard(1) |
kitten-clipboard - Copy/paste with the system clipboard, even over SSH
Copy/paste to the system clipboard from shell scripts
The clipboard kitten can be used to read or write to the system clipboard from the shell. It even works over SSH. Using it is as simple as:
echo hooray | kitten clipboard
All text received on STDIN is copied to the clipboard.
To get text from the clipboard:
kitten clipboard --get-clipboard
The text will be written to STDOUT. Note that by default kitty asks for permission when a program attempts to read the clipboard. This can be controlled via clipboard_control.
Added in version 0.27.0: Support for copying arbitrary data types
The clipboard kitten can be used to send/receive more than just plain text from the system clipboard. You can transfer arbitrary data types. Best illustrated with some examples:
# Copy an image to the clipboard: kitten clipboard picture.png # Copy an image and some text to the clipboard: kitten clipboard picture.jpg text.txt # Copy text from STDIN and an image to the clipboard: echo hello | kitten clipboard picture.png /dev/stdin # Copy any raster image available on the clipboard to a PNG file: kitten clipboard -g picture.png # Copy an image to a file and text to STDOUT: kitten clipboard -g picture.png /dev/stdout # List the formats available on the system clipboard kitten clipboard -g -m . /dev/stdout
Normally, the kitten guesses MIME types based on the file names. To control the MIME types precisely, use the --mime option.
This kitten uses a new protocol developed by kitty to function, for details, see Copying all data types to the clipboard.
The source code for this kitten is available on GitHub.
kitten clipboard [options] [files to copy to/from]
Read or write to the system clipboard.
This kitten operates most simply in filter mode. To set the clipboard text, pipe in the new text on STDIN. Use the --get-clipboard option to instead output the current clipboard text content to STDOUT. Note that copying from the clipboard will cause a permission popup, see clipboard_control for details.
For more control, specify filename arguments. Then, different MIME types can be copied to/from the clipboard. Some examples:
# Copy an image to the clipboard: kitten clipboard picture.png # Copy an image and some text to the clipboard: kitten clipboard picture.jpg text.txt # Copy text from STDIN and an image to the clipboard: echo hello | kitten clipboard picture.png /dev/stdin # Copy any raster image available on the clipboard to a PNG file: kitten clipboard -g picture.png # Copy an image to a file and text to STDOUT: kitten clipboard -g picture.png /dev/stdout # List the formats available on the system clipboard kitten clipboard -g -m . /dev/stdout
Kovid Goyal
2025, Kovid Goyal
January 18, 2025 | 0.39.0 |