run command from history ubuntu

C++
Use Key combination Ctrl - r, you will be able to use keyword to search bash history.
OR 
In bash, just !636 will be ok.

Source

Also in C++: