I found a great answer to this question herehere, it is worth repeating.
This can be achieved with ImageMagick. Install by running the command
sudo apt-get install imagemagick To grab all desktop just type
import -window root screen.png Or you can do it with a delay of 5 seconds
sleep 5; import -window root screen.png