Uninstalling Dependencies. Is This a Good Practice?

As far as I know I can uninstall a program from Ubuntu using this command...

$ sudo dpkg -r packagename

But this does not remove the dependencies while the packagename installed. To remove all files including dependencies we need to apply this command...

$ sudo apt-get --purge autoremove packagename

But my question is removing the package and all its dependencies is really a good practice? Will --purge autoremove command make my system as it before installing the packagename package? Or occasionally I might end up with some broken files and my system might crash while trying to remove everything? Actually I am afraid to implement the --purge autoremove command and want to know expert opinion before practising this!


It should be quite safe. Autoremove removes only packages, which were installed by dependency of a removed package. They should not be needed. You are correct. Your system should be as before you installed 'packagename'.


Autoremove only removes orphaned packages. Meaning that it is completely safe to use without disrupting any functional or currently installed programs.


It is quite safe most of the times, but when you use it you must check your terminal for the names of the packages that are about to be removed because sometimes errors happen. Do not agree to the removal of dependencies without having double checked the names of the packages that are about to be removed and see if there is any that shouldn't normally be there. Check what happened to me a few days before.