remove package with apt-get or dpkg [duplicate]
I am just wondering if I want to remove a package from my system say google-chome-stable, i have two ways of doing it:
sudo apt-get remove google-chrome-stable
and
dpkg -r google-chrome-stable
just wondering if both are exactly same or there is some technicality? and which one is the best practice?
Best practice:
use apt-get
or aptitude
or Ubuntu Software Center.
Is there a difference?
Yes
The actual installation/uninstallation is always done by dpkg. Apt and other utilities ask dpkg to do its job.
dpkg can not handle dependencies automatically. You either figure out dependencies, fetch all those packages and give them to dpkg all at once, or deal with the unmet dependencies mess. Apt handles this, and that is what I believe its primary use. Apt also brings in some fancy stuff. Look at its conf files for the full details.
Barring the dependency handling, the remove commands are equivalent. The only difference is apt refuses to remove a package that others depend on, without removing them, and it can be set up to remove automatically the packages that no one else needs as a dependency.