Everybody takes a desktop screenshot at some point. For whatever reason. In the true spirit of computer geeks I spent two three hours writing and testing a shell script that will take a screenshot of your Linux desktop, upload the screenshot to the Internet via Dropbox and pop the URL into your clipboard for instant pasting without any interaction on your part.

To save you the thirty-or-so seconds it would take to do this by hand.

Laziness, distilled.

Step 1: Dependencies

First off, install Dropbox if you don’t already have it. You can grab it via the link above. Or the link below (daddy wants his referrals). This script relies on two other CLI programs that you may or may not have installed: scrot and xclip. A very easy way to see if you have them is to open a shell and type in: whereis scrot && whereis xclip. If you don’t have them, check your distro’s repositories for the two programs. They are small and ubiquitous like leprechauns during the summer months:


Step 2:

Grab my screenie script here, and then chmod +x the script to make it executable.

Step 3: Important!

Third: IMPORTANT! After this you must open the script up in a text editor and modify the the $DBUSER variable to match your Dropbox UID:


You can find your Dropbox UID very easily from within your Dropbox folder or from on the Dropbox website. Navigate to your Public folder, right-click on any file and select “copy public URL” from the menu of options. Part of this URL is a numerical string. Replace CHANGEME with this string. As an example, my UID in the below URL for the script is “4144919”:


With all of those two, involved steps taken care of, you can run screenie locally or install it (as root) into your /usr/local/bin or equivalent folder for easy use.

Teh Script:

# Change DBUSER to match your Dropbox UID. For more intstructions, see above.
TIME=$(date +%Y%m%d%H%M%S)
if [ -d $PUB ]
   cd $PUB
   mkdir $PUB
   cd $PUB
sleep 1
scrot -d 5 -q 100 $TIME.jpg
sleep 1
LAST=$(find . -cmin -1 -iname "*.jpg" | tail -n 1 | sed 's!.*/!!')
echo "$URL1/$DBUSER/$URL2/$LAST" | xclip -sel clip
exit 0

Bonus step 4: Double Openbox laziness

If you are using Openbox you can take your laziness one step further by binding screenie to a keyboard shortcut. Push print screen. Twenty seconds later you have a smoldering hot URL in your clipboard yearning to be posted. Open up Openbox’s rc.xml file, usually to be found residing in ~/.config/openbox/, and add the following lines to the pertinent section:

<keybind key="Print">
   <action name="Execute">

in code

Mark Grealish

Dashing brigand, handsome rapscallion, father, crazy cat lady and the world's greatest lover and liar, living in Galway, Ireland.

Have your own say on 'New Dropbox hack: Automatic screenshot upload and URL':

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>