For interacting with the clipboard on GNU/Linux, I use xsel and xclip. The former is more concise, but the latter provides some useful features.

For example, `xsel` to read primary, `xsel -b` for what most users know as the clipboard, `-i` for writing. `xsel | xsel -ib` to copy from primary to clipboard.

`xclip -l 1 -quiet` to block until one paste. Useful to e.g. pipe a password from a password manager so that it gone after you paste it, or to chain pastes (user then pass).

Follow

I used a password manager and more as examples of xsel/xclip in my LibrePlanet 2019 talk:

mikegerwitz.com/talks/cs4m.pdf

You can also copy images (and more) to the clipboard. For example, here's a command that'll let you take a screenshot using ImageMagick by selecting a screen area with your mouse:

$ import png:- | xclip -i -selection clipboard -t image/png

Sign in to participate in the conversation
Mike Gerwitz's Mastodon Instance

Mike Gerwitz's personal Mastodon instance