Take a screen capture from the command line

Jul 11, 2010 - 3 Comments

terminal

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, Tips & Tricks

3 Comments

» Comments RSS Feed

  1. Alex says:

    Looking for a quick way of doing screenshots in Command+R via terminal with this command. Just gotta know what to fill in between the “/ /”

    /Volumes/name_of_HD/usr/sbin/screencapture -s /Volumes/name_of_HD/Users/name_of_user/Downloads/name_for_file.png

  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. […]

  3. […] 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 […]

Leave a Reply

 

Shop on Amazon.com and help support OSXDaily!

Subscribe to OSXDaily

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

Tips & Tricks

News

iPhone / iPad

Mac

Troubleshooting

Shop on Amazon to help support this site