Restore the Ubuntu panels back to their defaults

If you have accidentally moved everything around and you want to restore your panels back to their defaults, copy and paste the following in to the run dialog (Alt+F2):

gconftool-2 --recursive-unset /apps/panel && pkill gnome-panel

I have tested this on Ubuntu 8.10 and 9.10. (This does not work on the latest version of Ubuntu, see the updated section below).
On my system I did find that my panels were not restoring as I expected. This was because I had Ubuntu Studio installed which applies its own default theme and panel layout. So this can be resolved by removing the package ubuntustudio-default-settings

sudo apt-get remove ubuntustudio-default-settings

UPDATE FOR UBUNTU 10.04

Select Applications -> Accessories -> Terminal

Then copy and paste the following line and press enter:

gconftool-2 --recursive-unset /apps/panel && sleep 1 && nohup gnome-panel --replace &

You can then close the terminal window.

Note: This command does not work from the run dialog, so make sure you run the command from the terminal as described. If you are unable to select the terminal due loosing all your panels. Open the run dialog by pressing Alt-F2 and then copy and paste the following and press enter:

gnome-terminal