Wednesday 16 December 2015

thumbnail

How-to-take-screenshot-from-terminal-and-automate-it-in-Linux,Mac&Windows

How to take screenshot from terminal and automate it in Linux, Mac & Windows



1. Linux 

Scrot :-
  • It is a opensource software for taking screenshot from terminal. You can change the image quality and also you can change the format of image.
  • We can capture specific area and the whole screen is well.
  • We can also automate the scrot from cron to automatically take a screen at an interval of time.
  • This utility is useful for monitoring employees desktop.
  • Scrot is available in all linux distribution like Fedora, Ubuntu, Debain,etc. 
1. To install scrot open the terminal enter the following command :-

yum install scrot -y                   For Fedora/CentOS/Redhat

sudo apt-get install scrot -y          For Ubuntu/Debian

1.1. If you wish you can install it from source code as well :-

wget http://linuxbrit.co.uk/downloads/scrot-0.8.tar.gz
tar -xvf scrot-0.8.tar.gz
cd /scrot-0.8
./configure
make
su -c "make install"

Redhat user need to specify the prefix location with configure command:-

./configure --prefix=/usr

1.2. How to use scrot take screenshot :-

Some of the options are as follow:-

scrot /home/techs2resolve/Desktop.jpg            Full-Screenshot
scrot -s /home/techs2resolve/Window.jpg          Selected window "scrot -s" 
scrot -q 90 /home/techs2resolve/Quality.jpg      For image quality "scrot -q"

1.3. Now we have played with it lets automate the task in the background:-

Create a file called screen.sh :-

nano screen.sh


First of all we need to create a bash script :-

#!/bin/bash
DISPLAY=:0 scrot -q 20 /home/techs2resolve/Pictures/techs2resolve-%Y-%m-%d-%H_%M.jpg


Change the permission :-

chmod 777 screen.sh

Now It is important :- You have to open your user crontab don't open it from root.

*/1 * * * * sh /home/techs2resolve/screen.sh

The above cron will run at every 1 min and the screenshot will be save inside your Pictures folder of your home directory.



2. MAC



Screencapture :-

In Mac OSX screencapture utility comes by default. Just like scrot we will do for mac with the help of scripting.

1.Go to the Finder :-

Navigate to the Applications and launch Terminal :-



2. Now create the folder on Desktop "techs2resolve" :-

mkdir ~/Desktop/techs2resolve


2.1 Now run the following script on the terminal :-

while [ 1 ];do vardate=$(date +%d\-%m\-%Y\_%H.%M.%S); screencapture -t jpg -x ~/Desktop/techs2resolve/$vardate.jpg; sleep 10; done

where 
vardate = is the variable for date and time 
jpg        = is the format to save the screenshot
~/Desktop/techs2resolve = is the location where the screenshot go
sleep     = 10 sec time duration 
done      = completes while loop

3. Now we have to automate the screenshot with "Automator" :-


 3.1 After you have launched the Automator => Select Application :



3.2 Then Goto Utilities => Double click on "Run Shell script" :-



3.3 After that paste the script here in the box :-



3.4 Now Save the file as an "app" in Documents :-





 3.5. Now lets integrate it in startup :-

Launch System Preference => Users & Group => Select User

Goto "Login Items" => 
Click on the "+" To add the app from Documents







That's it now restart your system to check service is running in your panel top right side.



That' it now enjoy using it ,
Please Do Likes,Comment and Share


Subscribe by Email

Follow Updates Articles from This Blog via Email

11 Comments

avatar

hi and thanks for the actual blog post ive recently been searching regarding this specific advice on-line for sum hours these days as a result thanks app store mockup

Reply Delete
avatar

Thank you for your very good information and feedback from you. car dealers san jose apple app store mockup

Reply Delete
avatar

I was recommended this blog by my cousin. I am not sure whether this post is written by him as nobody else know such detailed about my problem. You’re incredible! Thanks! imac mockups

Reply Delete
avatar

There is noticeably a bundle to find out about this. I assume you made sure nice factors in options also. imac mock ups

Reply Delete
avatar

cool thanks for reis posting! btw are there feeds to your blog? I’d love to add them to my reader imac mockup png

Reply Delete
avatar

I’ve been exploring for a little bit for any high-quality articles or blog posts in this kind of house . Exploring in Yahoo I ultimately stumbled upon this website. Reading this info So i am glad to show that I have an incredibly good uncanny feeling I found out just what I needed. I such a lot indubitably will make certain to do not disregard this website and give it a look on a constant. mobile app developer

Reply Delete
avatar

Thank you for your very good information and respond to you. used car san jose website tips

Reply Delete
avatar

The author covered some curious points here. I came across this by using Yahoo and I must confess that I am currently subscribed for your blog, it is quite great ui/ux design

Reply Delete
avatar

I'm not against the agree with the things you suggested. front end development company

Reply Delete
avatar

The information you are providing that is really good. Thank for making and spending your precious time for this useful information. Thanks again and keep it up. Auditing company

Reply Delete
avatar

This article will outline all the different strategies you should be aware of when it comes to soccer.
Top ias coaching in mumbai

Reply Delete