How to save screenshot both to clipboard and disk?

Solution 1:

You can just add the xclip command to scrot -e:

scrot '%F_%T.png' -e 'xclip -selection clip -t image/png "$f"; mv "$f" ~/Desktop/'

Of course you don't need to move the file to the Desktop, it's just an example how to combine multiple commands ...

You might need to install scrot:

sudo apt install scrot

Solution 2:

Assuming you use the default Ubuntu desktop, just combine two options of the gnome-screenshot command for sending to the clipboard and to a file:

gnome-screenshot -c -f file.png

This will send the output to the clipboard and to a file, in this example in your Pictures folder, named according to the timestamp given by the date -Ins command.