In Ubuntu 8.04,there’s a check-box called “Headphone Jack Sense” in Sound Preferences to mute speakers when plug in earphones.But this option disappeared on Ubuntu 10.04’s sound preferences window.
If your laptop have the problem that sound still comes out from speakers after headphones plugged in,you can try following methods.

Method 1. Open a terminal window and run this command:

alsamixer

you should see following screen,use right and left arrow key to navigate to Headphone and press M to set default MM to 00.

Method 2.Go to System->Administration->Synaptic Package Manager,search “gnome-alsamixer”(without quotes) and install this.
Then run gnome-alsamixer by this command in terminal

gnome-alsamixer

and check “Headphone Jack Sense”