Screenshots from Command Line

Today I was wanting to screenshot some work I had done on a vector image inside of the window. Now, I have a pretty minimalistic install on my box. Due to this I didn’t have a screenshot application aside from The Gimp… or so I though.

Like almost everything else in Linux, it turns out you can take screenshots from the command line. To do this you use the import command.

import image.jpg

This will change your cursor to a plus symbol. Click the window you want to screenshot and it’ll save it to the current directory.

You may notice however that if your window isn’t in the foreground, it may require two or more clicks to get the window you want up so you can screenshot it. To do this, we simply need a delay.

import -pause 4 image.jpg

The -pause switch will delay the screenshot by the duration specified. In the example, we delay it for four seconds. Once the delay is up, again you will see the mouse cursor change to a plus symbol. Select the window you want to screenshot and it will save it to the current directory, unless you have specified a different one to save to.

Category:Linux