{"id":13158,"date":"2019-04-01T03:49:17","date_gmt":"2019-04-01T03:49:17","guid":{"rendered":"http:\/\/www.appservgrid.com\/paw92\/?p=13158"},"modified":"2019-04-01T03:49:17","modified_gmt":"2019-04-01T03:49:17","slug":"scrot-a-command-line-tool-to-take-desktop-server-screenshots-automatically-in-linux","status":"publish","type":"post","link":"https:\/\/www.appservgrid.com\/paw92\/index.php\/2019\/04\/01\/scrot-a-command-line-tool-to-take-desktop-server-screenshots-automatically-in-linux\/","title":{"rendered":"Scrot: A Command Line Tool to Take Desktop\/Server Screenshots Automatically in Linux"},"content":{"rendered":"<p><strong>Scrot<\/strong>\u00a0(<strong>SCReenshOT<\/strong>) is an open source, powerful and flexible, command line utility for taking screen shots of your\u00a0<strong>Desktop<\/strong>,\u00a0<strong>Terminal<\/strong>\u00a0or a\u00a0<strong>Specific Window<\/strong>\u00a0manually or automatically by\u00a0<strong>Cron<\/strong>\u00a0job. Scrot is similar to Linux \u2018<strong>import<\/strong>\u2018 command, but uses \u2018<strong>imlib2<\/strong>\u2018 library to capture and save images. It supports multiple image formats (JPG, PNG, GIF, etc), which you can specify while taking screen shots by using the tool.<\/p>\n<div id=\"attachment_6647\" class=\"wp-caption aligncenter\">\n<p><a href=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2014\/04\/Install-Scrot-Screenshot-Tool.jpeg\"><img loading=\"lazy\" decoding=\"async\" class=\"size-medium wp-image-6647\" src=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2014\/04\/Install-Scrot-Screenshot-Tool-620x387.jpeg\" sizes=\"auto, (max-width: 620px) 100vw, 620px\" srcset=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2014\/04\/Install-Scrot-Screenshot-Tool-620x387.jpeg 620w, https:\/\/www.tecmint.com\/wp-content\/uploads\/2014\/04\/Install-Scrot-Screenshot-Tool-1024x640.jpeg 1024w, https:\/\/www.tecmint.com\/wp-content\/uploads\/2014\/04\/Install-Scrot-Screenshot-Tool.jpeg 1440w\" alt=\"Install Scrot Screenshot Tool in Linux\" width=\"620\" height=\"387\" aria-describedby=\"caption-attachment-6647\" data-lazy-loaded=\"true\" \/><\/a><\/p>\n<p id=\"caption-attachment-6647\" class=\"wp-caption-text\">Scrot Screenshot Tool<\/p>\n<\/div>\n<h4>Features of Scrot<\/h4>\n<ol>\n<li>With scrot we can take screen shots easily without any additional work.<\/li>\n<li>We can also optimize the quality of the screen shots image (with the\u00a0<strong>-q<\/strong>\u00a0switch, followed by a quality level between\u00a0<strong>1<\/strong>\u00a0and\u00a0<strong>100<\/strong>. The default quality level is\u00a0<strong>75<\/strong>.<\/li>\n<li>It is very easy to installation and use.<\/li>\n<li>We can capture a specific window or a rectangular area on the screen with the help of switch.<\/li>\n<li>Can get all screen shots in a particular directory and also can store all screen shots in a remote PC or network server.<\/li>\n<li>Can monitor all Desktop PC in admin absent and prevent to unwanted activities.<\/li>\n<\/ol>\n<h3>Installing Scrot in Linux<\/h3>\n<p>We can install \u2018<strong>Scrot<\/strong>\u2018 on any Linux distribution. If you\u2019re using<strong>\u00a0RedHat<\/strong>\u00a0or\u00a0<strong>Debian<\/strong>\u00a0based distribution, you can use a package manager tool like\u00a0<strong>yum<\/strong>\u00a0or\u00a0<strong>apt-get<\/strong>\u00a0to install it as shown below.<\/p>\n<pre># yum install scrot\t\t\t[On <strong>RedHat<\/strong> based Systems]<\/pre>\n<pre>$ sudo apt-get install scrot\t\t[On <strong>Debian<\/strong> based Systems]<\/pre>\n<p>If you wish to install it from source code, then use the following commands.<\/p>\n<pre>$ wget http:\/\/linuxbrit.co.uk\/downloads\/scrot-0.8.tar.gz\r\n$ tar -xvf scrot-0.8.tar.gz\r\n$ cd \/scrot-0.8\r\n$ .\/configure\r\n$ make\r\n$ su -c \"make install\"<\/pre>\n<p><strong>Note<\/strong>: RedHat users, need to specify prefix location with configure command.<\/p>\n<pre>$ .\/configure --prefix=\/usr<\/pre>\n<h3>How to Use Scrot to take Screen shots<\/h3>\n<p>As I said above, scrot can capture an entire desktop, a terminal or a specific window. With the help of scrot you can also take screen shots of a shell\/terminal of a system that doesn\u2019t have a GUI support.<\/p>\n<h5>Take Full Desktop Screen Shot<\/h5>\n<p>Let\u2019s take a entire screen shot of the Desktop, using the following command in your terminal.<\/p>\n<pre>$ scrot \/home\/tecmint\/Desktop.jpg<\/pre>\n<div id=\"attachment_6641\" class=\"wp-caption aligncenter\">\n<p><a href=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2014\/04\/Desktop.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"size-medium wp-image-6641\" src=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2014\/04\/Desktop-620x387.jpg\" sizes=\"auto, (max-width: 620px) 100vw, 620px\" srcset=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2014\/04\/Desktop-620x387.jpg 620w, https:\/\/www.tecmint.com\/wp-content\/uploads\/2014\/04\/Desktop-1024x640.jpg 1024w, https:\/\/www.tecmint.com\/wp-content\/uploads\/2014\/04\/Desktop.jpg 1440w\" alt=\"Desktop Screen Shot\" width=\"620\" height=\"387\" aria-describedby=\"caption-attachment-6641\" data-lazy-loaded=\"true\" \/><\/a><\/p>\n<p id=\"caption-attachment-6641\" class=\"wp-caption-text\">Desktop Screen Shot<\/p>\n<\/div>\n<h5>Take Specific Window Screen Shot<\/h5>\n<p>If you would like to capture a specific area on the screen, you can use the following command with\u00a0<strong>\u2018-s\u2019<\/strong>\u00a0switch that allows you to interactively select the area with your mouse that you wish to take screen shot.<\/p>\n<pre>scrot -s \/home\/tecmint\/Window.jpg<\/pre>\n<div id=\"attachment_6642\" class=\"wp-caption aligncenter\">\n<p><a href=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2014\/04\/Window.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"size-medium wp-image-6642\" src=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2014\/04\/Window-620x380.jpg\" sizes=\"auto, (max-width: 620px) 100vw, 620px\" srcset=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2014\/04\/Window-620x380.jpg 620w, https:\/\/www.tecmint.com\/wp-content\/uploads\/2014\/04\/Window-1024x627.jpg 1024w, https:\/\/www.tecmint.com\/wp-content\/uploads\/2014\/04\/Window.jpg 1228w\" alt=\"Take Selected Window Screen shot\" width=\"620\" height=\"380\" aria-describedby=\"caption-attachment-6642\" data-lazy-loaded=\"true\" \/><\/a><\/p>\n<p id=\"caption-attachment-6642\" class=\"wp-caption-text\">Take Selected Window Screen shot<\/p>\n<\/div>\n<h5>Adjusting the Image Quality<\/h5>\n<p>With the help of \u2018<strong>-q<\/strong>\u2018 switch, you can specify the quality level of the image between\u00a0<strong>1<\/strong>\u00a0and\u00a0<strong>100<\/strong>. The default image level is set to\u00a0<strong>75<\/strong>, and the image output will be different depending upon the file format you specify.<\/p>\n<p>The following command will capture an image at\u00a0<strong>90%<\/strong>\u00a0the quality of the original high quality screen.<\/p>\n<pre>$ scrot -q 90 \/home\/tecmint\/Quality.jpg<\/pre>\n<div id=\"attachment_6644\" class=\"wp-caption aligncenter\">\n<p><a href=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2014\/04\/Quality.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"size-medium wp-image-6644\" src=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2014\/04\/Quality-620x387.jpg\" sizes=\"auto, (max-width: 620px) 100vw, 620px\" srcset=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2014\/04\/Quality-620x387.jpg 620w, https:\/\/www.tecmint.com\/wp-content\/uploads\/2014\/04\/Quality-1024x640.jpg 1024w, https:\/\/www.tecmint.com\/wp-content\/uploads\/2014\/04\/Quality.jpg 1440w\" alt=\"Take Quality Screen shot\" width=\"620\" height=\"387\" aria-describedby=\"caption-attachment-6644\" data-lazy-loaded=\"true\" \/><\/a><\/p>\n<p id=\"caption-attachment-6644\" class=\"wp-caption-text\">Take Quality Screen shot<\/p>\n<\/div>\n<h5>Take Screen Shots Automatically<\/h5>\n<p>Now if you would like to get automatically screen shots, than you need to create a simple shell script. Create a file \u2018<strong>screen.sh<\/strong>\u2018 with \u2018<strong>touch<\/strong>\u2018 command and add the following content to it.<\/p>\n<pre>#!\/bin\/sh\r\nDISPLAY=:0 scrot 'tecmint-%Y-%m-%d-%H_%M.jpg' -q 20 &amp;&amp; mv \/home\/tecmint\/*.jpg \/media\/tecmint<\/pre>\n<p>Now grant \u2018<strong>777<\/strong>\u2018 permission and set an\u00a0<strong>Cron<\/strong>\u00a0job.<\/p>\n<pre>$ chmod 777 screen.sh<\/pre>\n<p>Open a \u2018<strong>crontab<\/strong>\u2018 file and add the following entry. You can define custom interval time.<\/p>\n<pre>$ crontab -e<\/pre>\n<pre>*\/1 * * * * sh \/home\/tecmint\/screen.sh<\/pre>\n<p>The above\u00a0<strong>Cron<\/strong>\u00a0entry will run every \u2018<strong>1<\/strong>\u2018 minute and take screen shots and store them under \u2018<strong>\/media\/tecmint<\/strong>\u2018 directory with filename as date and time. After running script for\u00a0<strong>1<\/strong>\u00a0minute, this is what I found in my \u2018<strong>tecmint\u2019<\/strong>directory.<\/p>\n<div id=\"attachment_6645\" class=\"wp-caption aligncenter\">\n<p><a href=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2014\/04\/scrot.png\"><img loading=\"lazy\" decoding=\"async\" class=\"size-medium wp-image-6645\" src=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2014\/04\/scrot-620x447.png\" sizes=\"auto, (max-width: 620px) 100vw, 620px\" srcset=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2014\/04\/scrot-620x447.png 620w, https:\/\/www.tecmint.com\/wp-content\/uploads\/2014\/04\/scrot.png 806w\" alt=\"Automatic Screen shots\" width=\"620\" height=\"447\" aria-describedby=\"caption-attachment-6645\" data-lazy-loaded=\"true\" \/><\/a><\/p>\n<p id=\"caption-attachment-6645\" class=\"wp-caption-text\">Automatic Screen shots<\/p>\n<\/div>\n<h3>Reference Links<\/h3>\n<p><a href=\"http:\/\/linuxbrit.co.uk\/software\/\" target=\"_blank\" rel=\"nofollow noopener\">http:\/\/linuxbrit.co.uk\/software\/<\/a><\/p>\n<p><a href=\"https:\/\/www.tecmint.com\/take-screenshots-in-linux-using-scrot\/\" target=\"_blank\" rel=\"noopener\">Source<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Scrot\u00a0(SCReenshOT) is an open source, powerful and flexible, command line utility for taking screen shots of your\u00a0Desktop,\u00a0Terminal\u00a0or a\u00a0Specific Window\u00a0manually or automatically by\u00a0Cron\u00a0job. Scrot is similar to Linux \u2018import\u2018 command, but uses \u2018imlib2\u2018 library to capture and save images. It supports multiple image formats (JPG, PNG, GIF, etc), which you can specify while taking screen shots &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/www.appservgrid.com\/paw92\/index.php\/2019\/04\/01\/scrot-a-command-line-tool-to-take-desktop-server-screenshots-automatically-in-linux\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Scrot: A Command Line Tool to Take Desktop\/Server Screenshots Automatically in Linux&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-13158","post","type-post","status-publish","format-standard","hentry","category-linux"],"_links":{"self":[{"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/posts\/13158","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/comments?post=13158"}],"version-history":[{"count":1,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/posts\/13158\/revisions"}],"predecessor-version":[{"id":13162,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/posts\/13158\/revisions\/13162"}],"wp:attachment":[{"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/media?parent=13158"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/categories?post=13158"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/tags?post=13158"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}