Capture images from the screen and save them to a file or the clipboard from the command line in Mac OS X.

# To take a screen shot (default save path `~/`)
$ screencapture example.png

# To take a screen shot without the shadow
$ screencapture -oi example.png

# To capture a screen shot to the clipboard
$ screencapture -c

# To take screen shot after a 10-second delay
$ screencapture -T 10 example.png

# To take screen shot and save it as pdf
$ screencapture -t pdf example.pdf

# To quiet the audible snapshot sound
$ screencapture -x example.png

# To send the screen shot directly to mail
$ screencapture -M example.png

# To take screen shot and open in Preview
$ screencapture -P example.png

# Change the screen capture file format
$ defaults write com.apple.screencapture type png \
    && killall SystemUIServer