Copy/paste to the system clipboard from shell scripts
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 | kitty +kitten clipboard
All text received on
stdin is copied to the clipboard.
To get text from the clipboard you have to enable reading of the clipboard
kitty.conf. Once you do that, you can
kitty +kitten clipboard --get-clipboard
Command Line Interface#
kitty +kitten clipboard [options]
Read or write to the system clipboard.
To set the clipboard text, pipe in the new text on STDIN. Use the
--get-clipboard option to output the current clipboard contents to
stdout. Note that reading the clipboard will cause a permission
clipboard_control for details.
Output the current contents of the clipboard to STDOUT. Note that by default kitty will prompt you asking to allow access to the clipboard. Can be controlled by
Use the primary selection rather than the clipboard on systems that support it, such as X11. Default:
Wait till the copy to clipboard is complete before exiting. Useful if running the kitten in a dedicated, ephemeral window. Default: