Quick screenshot

import -pause 5 -window root desktop_screenshot.jpg
Requires ImageMagick. Takes a screenshot 5 seconds after it's run and saves it as desktop_screenshot.jpg Particularly handy when made into a menu option or button.

2009-04-01 22:37:33

These Might Interest You

  • When connected to a box via ssh you can do a quick screenshot of that box using this command. After that you can rscp it over to your box and look at it. Show Sample Output

    xwd -root -display :0.0| xwdtopnm | pnmtopng > Screenshot.png
    B4ckBOne · 2010-10-28 07:44:25 0
  • I often need to send screenshots to other people to explain settings and whatever. So I created this oneline which I use to create the screenshot with imagemagik, upload it via scp to my server and then the command opens an firefox tab with the screenshot. The screenshot can be a region or a window. You just have to replace the parts beginning with YOUR.

    FILE="`date +%m%d%H%M%S`.png"; URL="http://YOUR_HOST/YOUR/PATH/$FILE"; TMP="/tmp/$FILE"; import -frame $TMP; scp $TMP YOUR-USER@YOUR-HOST:/YOUR/PATH/; rm $TMP; firefox "$URL"
    TheBunman · 2009-02-21 18:42:33 4
  • when using Gnome or KDE, you will have a hard time getting a screenshot of something like a login screen, or any other screen that occurs before the desktop environment is up and monitoring the printscreen key. (this probably applies for other DEs as well, but I haven't used them) What this command is meant to do is take a screenshot of an X window using a command you can run from your virtual terminals (actual text terminals, not just an emulator) To do this: Press CTRL+ALT+F1 to go to a virtual (text) terminal once your login window comes up Login to the virtual terminal and enter the command (you'll have to type it in) You should now have a file called screenshot.png in your home directory with your screenshot in it. For those of you who are new to the virtual terminal thing, you can use CTRL+ALT+F7 to get back to your regular GUI From http://www.gnome.org

    chvt 7 ; sleep 2 ; DISPLAY=:0.0 import -window root screenshot.png
    camocrazed · 2010-08-20 17:28:49 1
  • Take a screenshot, give $1 seconds pause to choose what to screenshot, then upload and get URI of post in ompdlr.org Show Sample Output

    scrotit(){ echo "Screenshot in $1 seconds...";scrot -d $1 '%Y%m%d%h.png' -e 'curl -sF file1=@- http://ompldr.org/upload < $f | grep -P -o "(?<=File:).*(http://ompldr.org/.*)\<\/a\>";rm $f'| sed -r 's@.*(http://ompldr.org/\w{1,7}).*@\1@';}
    dzup · 2012-12-03 01:21:19 0

What Others Think

The command scrot is also handy for this: sleep 5; scrot; Also, by default, timestamps the screenshot, so you don't have to overwrite the last one. I believe it's installed by default on ubuntu and debian, but I could be wrong. Also, because I like overcomplicating things: for t in {2..8}; do (sleep $t ; echo -e "\a" ;scrot)& done; This will take a snapshot from two seconds after you start it, to 8 seconds, beeping with every snap. Also, have you ever tried hitting the printscreen button? It usually launches a handy screenshot utility. On KDE, for example, there is ksnapshot, and there is something similar for gnome.
clockworkavian · 480 weeks and 5 days ago
scrot is my choice scrot -d 5 or better scrot -cd 5 -q 100 screenshot.png
JesusSuperstar · 480 weeks and 5 days ago
Better yet, what do people use for (hopefully lossless) screen video capture?
bwoodacre · 480 weeks and 5 days ago
how about changing the filename from desktop_screenshot.jpg to desktop_screenshot`date +%d%b%H%M`.jpg ? Wouldn't overwrite the last screenshot :)
ninadsp · 445 weeks and 5 days ago
What about using xwd and convert ? This is the way I choose. xwd -root | convert - -quality 100 foo.png Well I really don't like to use date as name for screenshot , I normally use a specific one.
nrn · 429 weeks and 4 days ago

What do you think?

Any thoughts on this command? Does it work on your machine? Can you do the same thing with only 14 characters?

You must be signed in to comment.

What's this?

commandlinefu.com is the place to record those command-line gems that you return to again and again. That way others can gain from your CLI wisdom and you from theirs too. All commands can be commented on, discussed and voted up or down.

Share Your Commands

Stay in the loop…

Follow the Tweets.

Every new command is wrapped in a tweet and posted to Twitter. Following the stream is a great way of staying abreast of the latest commands. For the more discerning, there are Twitter accounts for commands that get a minimum of 3 and 10 votes - that way only the great commands get tweeted.

» http://twitter.com/commandlinefu
» http://twitter.com/commandlinefu3
» http://twitter.com/commandlinefu10

Subscribe to the feeds.

Use your favourite RSS aggregator to stay in touch with the latest commands. There are feeds mirroring the 3 Twitter streams as well as for virtually every other subset (users, tags, functions,…):

Subscribe to the feed for: