Take a screen capture from the command line

Jul 11, 2010 - 2 Comments

Taking screenshots from the command line is made easy, thanks to a utility included in Mac OS X called screencapture. Here’s how to use it:
screencapture test.jpg The screen capture will then appear in the directory that the command was executed.

There are more advanced features to the screencapture utility though, here’s a few examples.

Open the screencapture in Preview immediately after being taken:
screencapture -P test.jpg

Take screenshots silently, with no sound playing:
screencapture -x silentscreenshot.jpg

Delay when the screenshot is taken by using the -T flag followed by seconds:
screencapture -T 3 delayedpic.jpg

Specify a file type for the screenshot (most major image formats are supported: JPG, PNG, PDF, etc):
screencapture -t pdf pdfshot.pdf

Like most other terminal commands, you can combine the flags together and do all of the above at once:
screencapture -xt pdf -T 4 pic.jpg

To see a full list of screencapture options, use the -h flag:
screencapture -h

These instructions appeared on our screen capture in Mac OS article.

Related articles:

Posted by: Manish Patel in Command Line, Mac OS X, Tips & Tricks

2 Comments

» Comments RSS Feed

  1. [...] already know that you can take screenshots from the command line, but now using a simple tool called webkit2png you can quickly take a screenshot of any webpage [...]

  2. [...] Instead of disabling the screen shot shadow completely you can take a one-time screen capture minus the shadow by using either the Grab app or by using the command line screencapture utility. [...]

Leave a Reply

 

Shop for Apple & Mac Deals on Amazon.com

Subscribe to OSXDaily

Subscribe to RSS Subscribe to Twitter Feed Follow on Facebook Subscribe to eMail Updates

OSXDaily on Facebook

OSXDaily on Google+

Shop at Amazon

Ad

Shared on Facebook