To record short screencasts on Ubuntu I use byzanz. Byzanz is a desktop recorder and command line tool allowing you to record your current desktop or parts of it to an animated GIF, Ogg Theora, Flash or WebM.
sudo apt-get install byzanz
To use: (with 5 second delay)
byzanz-record --delay=5 --duration=10 --x=878 --width=722 --height=434 ~/Desktop/vim.gif
or an alternative syntax: (using both X and Y)
byzanz-record -d 10 -x 878 -y 200 -w 722 -h 434 ~/Desktop/vim.gif
Above I’m recording my terminal for 10 seconds. I’m declaring the coordinates manually of where I want to record. Then declaring where I want the recording to be saved and what I want it to be called, in this case my desktop and vim.gif.
Obviously if you want to know more about what parameters you can use just call:
If, like me, you don’t know the exact width, height X, and Y coordinates of where you want to record on your screen then you can use
xwininfo. This handy tool will give you can necessary info about the window you want to record.