The following text copied from this critical:
As often happens in GNU/Linux, the command line still offers a rich array of choices. If these utilities do not stay open by default, they can at least be quickly recalled by scrolling back in the command history. Most of them offer only a limited ability to edit the result -- although, surprisingly, they tend to offer more editing options than most of the desktop alternatives.
The venerable XWD is still installed in many distributions by default, but, despite offering a range of options, including whether to include the window manager frame of a window, it outputs to only .xwd format, and therefore requires the additional step of exporting to another format for Web and other uses.
By contrast, ImageMagick is a more versatile old-time command line tool. Through its import utility, ImageMagick not only supports export to more than 90 image formats, including common ones such as PNG, GIF and JPEG, but also gives users options to combine images, annotate, choose the compression level in formats where a choice is available, and crop and resize.
Another useful tool on the command line is Tom Gilbert's scrot. On his home page, Gilbert compares scrot to ImageMagick, but, if anything, it is even more versatile. In addition to a delay, and the ability to select the desktop region and include the window frame, scrot also includes a number of features that, in my experience, are unique to screenshot programs, including a countdown for the delay, the selection of image quality, and the on-the-fly creation of a thumbnail based on a percentage of the size of the output image. In addition to these parameters, the name of the output image can take special strings to control its size and format. Scrot even gets around the problem of not having editing tools available by including a parameter that opens any program specified after the shot is taken.
A more specialist tool is Byzanz, which is designed to record animated GIFs. The program offers a delay before recording, and the setting of the exact coordinates on the X and Y axes of the desktop to include in the recording. In practice, setting the region for Byzanz requires considerable trial and error for new users, and even experienced ones are likely to have trouble using it with any precision.
For screencasts from the command line, Xvidcap is an option, although the official site does not seem to be updated since 2004. You can use Xvidcap to capture single frames or to create a video, with the option of including the mouse cursor and audio. The program is also available in a graphical version called Gvidcap.