All the answers given so far are way too drastic. You don't need to
apt-get purge firefox or
rm -rf ~/.mozilla to get what you want.
Here's the thing. Firefox doesn't store any user data in itself. What it does instead is create what's known as a "user profile" -- a directory in your home directory -- and store all your data in there. And by data I mean everything -- add-ons, themes, browsing history, stored passwords, and on and on. (The actual location of your profiles in the filesystem varies by OS; on Ubuntu and other Linuxes, it's generally in
.mozilla/firefox in your home directory.) Data in the user profile is completely separate from the Firefox application itself, so removing Firefox via
apt-get or the like won't delete the profile data; when you reinstall Firefox later, it'll just look up your profile and reload it all, which can be frustrating if you don't realize what's going on.
When you first use Firefox, it silently creates a default profile for you, and uses that profile from that day onward. But you don't have to use that profile. Firefox supports multiple profiles, and you can switch back and forth between them at will. This means that to get Firefox back to the way it was the day you first installed it, you don't have to touch the Firefox binaries at all -- all you have to do is create a new, empty profile, and use it instead of your old, cluttered one. Restart Firefox and it'll be like you never ran it before.
Here's how to create a new FF profile in Ubuntu:
- Close all running Firefox windows
- Open a console window (profile management is only accessible via the command line)
- Run the following command at the prompt:
- This will launch the Firefox Profile Manager -- a dialog box that looks like this:
Yours will probably only have one profile listed -- that's your current, default profile, with all your add-ons and other stuff. It'll have a name that starts with a string of random characters; that's because FF had to come up with a name for it when it automatically created the profile, so it just used a random string.
- Click the "Create Profile" button. This will launch a wizard walking you through defining a new, empty profile. When that process is complete you'll be returned to the Profile Manager dialog box, now with two profiles listed, your old one and your new one.
- Select your newly created profile.
- Optional: if you want Firefox to use your new, empty profile from now on by default, check the "Don't ask at startup" box. If you'd prefer FF to prompt you for which profile you want to use each time you run it, leave that box unchecked.
- Click "Start Firefox".
Now Firefox will restart, completely fresh and new as the first day you downloaded it. Problem solved. And if you ever need to retrieve something from your old profile, like your old bookmarks, say, all your old data is archived in your old profile, so you can safely retrieve it later.