You will need to have the software ImageMagick installed in the machine you like to take screenshot from. Then you'll have the command import which takes the shots.
To take capture of the whole screen, use this:
$ import -window root /path/file.png
Then you can do some other stuff with it like resize to more suitable size:
$ import -window root -resize 600 /path/file.png
And you can do it even if you are not at the X session:
$ import -window root -resize 600 \
-display :0 /path/file.png
So you even could take a screenshot vía ssh:
$ ssh user@host "import -window root \
-resize 600 -display :0 png:-" > /tmp/myshot.png .
UPDATED: To simplify the ssh version, I removed the
scp and redirect the output to a local file. The
png:- indicates that the format is
png and the the file
-, which is the standard output.