os/linux/ UsefulX11Utils


Copy and paste: xsel(see here) xclip.

Pasting an Image with xclip

xclip -selection clipboard -t image/png -o > "image_file.png"

for which I have written a simple script

#!/bin/bash
o="$1"
if [ -n "$CLOBBER" -a -e "$o" ]; then
  /bin/rm -f "$o" || { echo "can't overwrite $o"; exit 1; }
elif [ -e "$o" ]; then
  echo "Not overwriting $o"
  exit 2
fi
xclip -selection clipboard -t image/png -o > "$o"

so that I need only type

paste_png image_file.png

or

CLOBBER=y paste_png image_file.png

(I could make it easier to clobber if I find I'm doing it alot, but of course you could export CLOBBER=y so that you don't have to use CLOBBER on every command. That's why I'm a fan of allowing the use of environment variables for most options of a command.)