A command-line clipboard copy and paste utility?

xsel

I am using xsel Install xsel, but I am only using it with plain text and unicode text.

xsel can copy and paste to three different "clipboards".

By default, it uses the X Window System primary selection, which is basically whatever is currently in selection. The X Window System also has a secondary selection (which isn't used much), and a clipboard selection. You're probably looking for the clipboard selection, since that's what the desktop environment (e.g. Gnome, KDE, XFCE) uses for its clipboard. To use that with xsel:

xsel --clipboard < new-clipboard-contents.txt
xsel --clipboard > current-clipboard-contents.txt

xclip

Install xclip may be one of your choices.

cat samples.sh | xclip -sel clip

you can also setting it in the .bashrc file using alias.

alias clipboard='xclip -sel clip'

The key to paste binary data to a file with xclip is to tell what Media Types you have on clipboard. For PNG you can:

xclip -selection clipboard -t image/png -o > "`date '+%Y-%m-%d_%T'`.png"

So now on ~/Dropbox/.mybashrc ;) you can add an alias (clipboard2photo) to easily paste to image file (maybe someday we'll have it on Nautilus).


Parcellite

I've used parcellite for many years as a clipboard manager. It runs in the Notification Area and offers many options for managing both Primary Selection and standard freedesktop.org Clipboard.

Tray Icon

It's been my answer to managing clipboard items.

Preferences