Take Screenshots in Linux with “scrot”

I have found this tool recently, and I have no idea how I was able to manage without it before.

This tool allows you to capture any region of your screen, by selecting it with your mouse, clicking on the title-bar of a window and other methods. It’s very flexible and contains many options.

To download the program in Ubuntu:

sudo apt-get install scrot

Now, open a new text file and type this

1
2
#!/bin/bash
scrot "/home/YourUsername/Desktop/screenshot`date +%d_%m_%y_%H_%M_%S_%N`.png" -s -q '85'

Don’t forget to replace YourUsername with your actual username. We’ll assume that you called the file “scrshot”

This script will call scrot, will tell it to save the screenshots on your desktop with names similar to screenshot14_11_08_00_36_41_278273217.png (I know the name looks ugly, but I love this nomenclature because it prevents file name conflicts). The -s flag is for “Select”: This will allow you to select any area/window with your mouse. The -q flag is for “Quality”: In the above script I set it to 85%, which is good enough. Note that increasing the quality will also increase the file size.


Now, make the file executable:

chmod +x scrshot

Add a new launcher to you gnome panel, give it a suitable name and let it execute the above script. (i.e., in the “Command” field, enter the path to the script, eg. /home/YouName/scripts/scrshot  or wherever you saved it).

No taking a screenshot is easy: Click the launcher, select a region, and go to your desktop to collect the resulting file.

Actually, scrot is more powerful than described in this post, one of its strong features is adding a delay so the script will wait for a given number of seconds before taking the screenshot.

For more options refer to the manual pages:

man scrot

If you enjoyed this post, make sure you subscribe to my RSS feed!

Post to Twitter Post to Delicious Post to Digg Post to Facebook Post to Reddit Post to StumbleUpon

No related posts.

Tags: , ,

Friday, November 14th, 2008 Linux

9 Comments to Take Screenshots in Linux with “scrot”

  • Bellerofonte says:

    I just try to pass from windows to linux and in Windows there was a tool that i use frequently and it was for me very important: Fscapture.
    In this little time i have searched for a equivalent in Ubuntu, that can take a screenshot from the desktop ( in particular a region of the screen,gnome it can’t)and save automatically the image in my desktop….

    This is the solution!!!!

    Thank You very much Amir u are a Genius!

    Now i will link your script with the shortcut ptrscr & prtscr+alt u can help me?

    P.S Scuse me for my English: I’m Italian :-D

  • Amir Watad says:

    Happy that you found it useful. And thank you for your comment :)

  • Bellerofonte says:

    Hi Amir,
    I will to complete my work if u can help me :)

    In my previously Reply i said u that i would like to link your script to
    a shortcut key.
    I read this post

    http://www.systembeta.com/html/Linux/200809/12-482.html

    and i resolve the problem with the stamp of all the desktop
    (i have disable gnome-screenshot shortcuts)
    but i can’t use the option -s in scrot using keybinding_commands…
    can u tell me why and can u have a solution for me?

    thank u very much

  • Amir Watad says:

    Hi Bellerofonte,
    Thanks again for your comment. I’m sorry, I didn’t notice your question in the previous comment (my bad).
    I’ll look at your issue, but I can’t promise to do this soon since I have exams next week. If you find a solution before me please share it with us.

    Thank you :)

  • Bellerofonte says:

    Hi Amir,

    what about Gscrot?
    I can install it with scrot?

  • Amir Watad says:

    Hi :)
    I don’t know what is Gscrot. If it exists then I think it might be a graphical frontend for scrot?

  • Vadim P. says:

    http://gscrot.ubuntu-projekte.de/

    It’s not a frontend for scrot anymore, so it’ll be renamed to “Shutter” soon.

  • Amir Watad says:

    Thank you Vadim for your comment.

  • Trackbacks/Pingbacks

  • [...] Take Screenshots in Linux with scrot – Fantastic little tool for taking screenshotstags: linux ubuntu howto [...]

  • Leave a Reply

    my email
    my photo
    Hi,
    My name is Amir Watad. I have a BSc. in biomedical engineering from The Biomedical Engineering school , Technion , Israel, and a BSc. in electrical engineering from The Electrical Engineering school , Technion , Israel.
    I'm a Verification Engineer in Mellanox Technologies Ltd.
    I love Linux, the Command Line and the OpenSource Community.
    I used to write Poems (Arabic) when I was able to find time for this.
    November 2008
    S M T W T F S
    « Oct   Dec »
     1
    2345678
    9101112131415
    16171819202122
    23242526272829
    30  
    SEO Powered by Platinum SEO from Techblissonline

    Twitter links powered by Tweet This v1.7.3, a WordPress plugin for Twitter.