Lost grub2 menu entry - boot and recover grub

I had this situation where my grub2 menu entry was lost and it gave me a command prompt which looks like grub >. After some searching I found the appropriate solution which suited me.
ls
funnily enough yes ls will list all your partitions ( similar to our fdisk -l command )
set root =(hd0,1)
In this case I want to enter the first parition. I dont have multiple partitions here.
linux /vmlin ( should autocomplete with kernel number ) root=/dev/sda3
Here sda3 is the location of my root filesystem, it can be sda5 or some other number.
initrd ini (should autocomplete with the image number )
similar to above
boot
This should boot into the system, run these as root after you boot.
update-grub2
Updates the menu entries
grub-install /dev/sda
Installs them to the boot sector of sda disk.