Installing scrot

The tool that we are going to use is scrot. Scrot is a command line utility that allows you to capture screenshot from the terminal. Scrot is in the Ubuntu repository, so you can simply install from Ubuntu Software Center, or in the terminal:

Capturing screenshots at regular interval

To use Scrot to capture screenshots automatically at regular interval, all you need to do is to run the following command in the terminal: Here are a few parameters that you need to change:

int – the number of seconds before each screenshot is taken filename – the filename of the screenshot. You can use variables like %Y, %m, %d, %H, %M, %S $w, $h to denote the year, month, day, hour, minute, seconds, width and height respectively. jpg|png – take the screenshot in either jpg or png format. Include only one, but not both. file/path/to/store/screenshots – the location where you want to move the screenshots to

For example, if you want it to take a screenshot at every 5 seconds and save it to the Pictures folder. This is the command to use: Note: Press Ctrl + z to end the process. Note: Depending on your monitor size and amount of resources in your computer, Scrot will take about 1 -2 second to complete each cycle. This means that when you set the interval at 5 seconds, the screenshot will only be taken at 6 -7 seconds. You might want to adjust the interval to compensate for this lag After running it for 1 minute, this is what I found in my Pictures folder.

The above command will run the process forever until you stop it manually. If you want to get it to run for a certain count, say 100 loops, you can use the command below: This will take 100 screenshots at an interval of 5 seconds.

Putting it in script

It is barely useful if you need to type the command everytime you want to run the process. The best way is to turn it into a script where you can run it anytime, everytime. Open a text editor and paste the following commands: Save the file as auto-screenshot.sh in your Home folder. Grant it executable permission: Now you can run the process by using the command in the terminal:

Automating the screen capturing process

If you want to schedule the screen capturing process to run at a certain time everyday, the fastest way is to set a cronjob. If you prefer a more graphical approach, Gnome Schedule is one good app that you can use, provided you are using the Gnome desktop. For further automation, you can even use CuttleFish to trigger the screen capturing process when a condition is met. What other ways do you use to automate screen capturing at regular interval? Image credit: Print Screen by BigStockPhoto