You can research the following commands:
To save the MBR to a file (this contains the partition table too):
dd if=/dev/sda of=sda-mbr-full bs=512 count=1
To save the MBR, without the partition table, to a file:
dd if=/dev/sda of=sda-mbr-nopart bs=446 count=1
To restore the MBR:
dd if=sda-mbr-nopart of=/dev/sda
To restore the MBR only part of the MBR and Part:
dd if=sda-mbr-full of=/dev/sda count=1 bs=446
But be very careful with dd, as you can destroy your data if you don't know what you are doing. Don't just copy and past the above code. You would need to rewrite it to your needs. And of course you would need to unmount the drive.
Most Linux distros will check for other os installed and ask you if you want to include them in the boot, when you are installing linux.
There is also a command that you can use while in grub to add another os to the boot menu.