To do this action
Use this shortcut
Take a picture of the whole screen
Command-Shift-3
Take a picture of part of the screen
Command-Shift-4 and drag to select the area you want in the image
Take a picture of a window, the menu bar, or the Dock or other area
Command-Shift-4-spacebar; move the camera icon over the area you want to select and then click