asciinema is the most perfect tool for this job. asciinema [as-kee-nuh-muh] is a free and open source solution coded in python for recording terminal sessions and sharing them on the web.
The features include simple recording, ability to copy and paste and the awesome part embedding. Share your terminal session clips just like pastebin pastes.
To Install asciinema on linux :
$ sudo apt-get install asciinema
To Start recording a terminal session :
$ asciinema rec
To Stop recording a terminal session :
Below, a small embedd for my terminal session.
Related Links :