This is a quick post on how to completely remove a package on Ubuntu so that the global configuration files and package dependencies are also removed.
The following command will remove a package and its global configuration.
sudo apt-get remove --purge [PACKAGE]
If you want to remove the dependent packages that were installed with the package you are removing, add the autoremove switch. For example.
sudo apt-get autoremove --purge [PACKAGE]