Jump to content

Recommended Posts

Posted

<div class="KonaBody"><p><img src="http://osxdaily.com/wp-content/uploads/2011/08/screen-shot-terminal-mac-os-x.gif" alt="Take Screen Shots from the Terminal in Mac OS X " title="screen-shot-terminal-mac-os-x" width="600" height="323" class="aligncenter size-full wp-image-20130" /></p>

<p>Aside from the keyboard <a href="http://osxdaily.com/2010/06/09/screen-capture-in-mac-os-x/">shortcuts</a>, Grab, and other screen shot apps, you can also take screenshots of your Mac OS X desktop directly from the Terminal with the ‘screencapture’ command. Here’s a quick overview of this utility and how to use it.</p>

<p><strong>The Basics: Taking a Screen Shot from the Terminal</strong>

First up, launch the Terminal (/Applications/Utilities/) and then type the following:</p>

<p><code>screencapture test.jpg</code></p>

<p>That is the most basic format of the command, it’ll take a screenshot of your entire screen and name it ‘test.jpg’ in the current working Terminal directory, which is typically your user home. You can always specify another location just by choosing a path for the screenshot, here’s the Desktop:</p>

<p><code>screencapture ~/Desktop/screenshot.jpg</code></p>

<p><strong>Send the Screen Shot to the Clipboard</strong>

If you want to send the screenshot to your clipboard rather than to a file, attach the -c flag, but don’t assign a file name or path:</p>

<p><code>screencapture -c</code></p>

<p>Now that it’s in your clipboard you can just paste it into Preview, Photoshop, Pages, or whatever else you want to use.</p>

<p><strong>Take a Screenshot on a Timer</strong>

One of the better features of the Grab utility is that it lets you<a href="http://osxdaily.com/2011/05/01/take-a-timed-screen-shot-in-mac-os-x/"> take screenshots on a timer</a>, so you can setup an app or situation on the screen and capture things like alert boxes, menus, button actions, etc. You can also specify a timed screenshot from the Terminal:</p>

<p><code>screencapture -T 10 timedshot.jpg</code></p>

<p>The -T flag needs to be followed by whatever amount in seconds you want to delay the screen shot by, in that example, it’s 10 seconds which is also Grabs default. </p>

<p><strong>Specify a Screen Shot File Type</strong>

Make a note that the capitalization of these flags matters, if you use a lowercase -t, you’ll be trying to specify a file type for the screenshot instead, like so:</p>

<p><code>screencapture -t tiff sample.tiff</code></p>

<p>You can select a variety of file types to export to, including png, pdf, tiff, jpg, and gif. </p>

<p><strong>Taking a Silent Screen Shot from the Command Line</strong>

If you plan on scripting out something with the screencapture command, you might not want the shutter sound to fire. To silently take a screen shot just use the -x flag:</p>

<p><code>screencapture -x quiet.jpg</code></p>

<p>This is a one time thing so you’ll have to always specify -x, it’s not a permanent change to make the screen shots silent.</p>

<p><strong>Send the Screen Shot to a New Mail Message</strong>

Another neat trick is sending the screenshot directly to a new Mail.app message:</p>

<p><code>screencapture -M mailme.jpg</code></p>

<p>This takes the screenshot, saves it as mailme.jpg, then automatically opens a new Mail message with that screenshot attached to it.</p>

<p>As with all command line tools, you can add the flags together to perform a variety of functions in a single command. If you want to see the other options available to you, just use the traditional -h flag with screencapture:</p>

<p><code>screencapture -h</code></p>

<p>This will list out all of the available flags and what they do, and there are a variety of additional options available, like <a href="http://osxdaily.com/2011/05/26/take-screen-shot-without-shadow-mac/">ditching the shadow</a>, automatically launching in Preview, choosing Window Capture mode, and more. You can see a screen shot of the screencapture commands at the top of this post (redundant?).</p>

<p>If you really wanted to get creative, you could do things like setup an automatic mail a screenshot function based on Mac desktop events, or even assign a key to for the clipboard function and create your own <a href="http://osxdaily.com/2010/05/13/print-screen-mac/">Mac Print Screen button</a> to duplicate that keyboard clutter that Windows users so dearly love, but those are topics for another post.</p>

<p>Finally, if you’d rather stick with the familiar Command+Shift+3 commands, don’t forget <a href="http://osxdaily.com/2011/01/26/change-the-screenshot-save-file-location-in-mac-os-x/">you can change the screen shot file type and save location</a>, but that’ll require a quick trip to the Terminal as well. That command is the same in Mac OS X 10.7 and prior versions too.</p>

</div>

<p><a href="http://feedads.g.doubleclick.net/~a/sk2osrz5tIBgkjvi92VEkKBRWE8/0/da"><img src="http://feedads.g.doubleclick.net/~a/sk2osrz5tIBgkjvi92VEkKBRWE8/0/di" border="0" ismap="true"></img></a><br/>

<a href="http://feedads.g.doubleclick.net/~a/sk2osrz5tIBgkjvi92VEkKBRWE8/1/da"><img src="http://feedads.g.doubleclick.net/~a/sk2osrz5tIBgkjvi92VEkKBRWE8/1/di" border="0" ismap="true"></img></a></p><div class="feedflare">

<a href="http://feeds.feedburner.com/~ff/osxdaily?a=o_Vqj_oRW60:BdyFhBI1TTM:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/osxdaily?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/osxdaily?a=o_Vqj_oRW60:BdyFhBI1TTM:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/osxdaily?i=o_Vqj_oRW60:BdyFhBI1TTM:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/osxdaily?a=o_Vqj_oRW60:BdyFhBI1TTM:D7DqB2pKExk"><img src="http://feeds.feedburner.com/~ff/osxdaily?i=o_Vqj_oRW60:BdyFhBI1TTM:D7DqB2pKExk" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/osxdaily?a=o_Vqj_oRW60:BdyFhBI1TTM:7Q72WNTAKBA"><img src="http://feeds.feedburner.com/~ff/osxdaily?d=7Q72WNTAKBA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/osxdaily?a=o_Vqj_oRW60:BdyFhBI1TTM:qj6IDK7rITs"><img src="http://feeds.feedburner.com/~ff/osxdaily?d=qj6IDK7rITs" border="0"></img></a>

</div><img src="http://feeds.feedburner.com/~r/osxdaily/~4/o_Vqj_oRW60" height="1" width="1"/>

 

View the full article

  • Replies 0
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic


×
×
  • Create New...