I have a graphic on the clipboard on ubuntu.

What's the quickest way to get it onto disk as a png or jpg?


I just threw together a quick python script that will paste a clipboard image to a file.

It's very basic but it does the job but could be easily extended.


| improve this answer | |


xclip (man page) is on official repos of major distros (pasteimg it isn't and last update was on 2011).

For me the quickest way is using terminal, going to the desired folder (maybe using autojump) and then just run clipboard2photo, which is an alias I created to the following command:

xclip -selection clipboard -t image/png -o > "$(date +%Y-%m-%d_%T).png"

With something on clipboard you can get all possible targets with: xclip -selection clipboard -o -t TARGETS

GNOME Shell shortcuts

On GNOME Shell (Ubuntu 17.10+) we have built in shortcuts to save screenshots directly to ~/Pictures:


Hints to remember them:

  • Ctrl → to clipboard (else to ~/Pictures)
  • Alt → Current window
  • Shift → Area/Surface

I usually disable "Print" to avoid generating garbage on ~/Pictures if I miss F12 (which I use a lot with Guake) and accidentally press it.

Tip 1: Put your aliases on ~/Dropbox/.mybashrc (or maybe better .myprofile) and then include this file from .bashrc.

[ -r ~/Dropbox/.mybashrc ] && source ~/Dropbox/.mybashrc

This way you will have them on all your current and future devices.

Tip 2: In the same way you can: thisOutputMarkdown | pandoc -s -f markdown -t html | xclip -selection clipboard -t text/html to get formatted HTML to clipboard.

| improve this answer | |

I've been googling for a while and it seems as if there is no clipboard manager yet that supports pasting of an image directly in a folder, even though there is this Nautilus feature request.

So the answer would be paste it in a graphics application (e.g. gimp) and save it.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.