19

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?

2
  • @ulcha Does that really answer this? If so, can you point to where? Explaining the general difference between apt-get and dpkg doesn't really address this specific issue. Mar 3, 2014 at 2:10
  • The real answer to this question, with detail on apt-get remove and apt-get purge.
    – Bob Stein
    Oct 16, 2014 at 15:42

1 Answer 1

15

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.

4
  • Thank you for your reply, just few more queries, 1: apt-get when removes a package, it removes its dependencies as well? 2: If so, what if other packages are also dependent on those dependencies?
    – user251447
    Mar 2, 2014 at 13:35
  • 1
    It is intelligent. It figures what can be removed, and offers. If auto clean is set, only then it removes the absolutely unneeded packages automatically. And yes, using dpkg can be disastrous.
    – Mahesh
    Mar 2, 2014 at 13:38
  • oh, I got my answer in the last part. this means that using dpkg can be disastrous to remove a package, as far as i get from your answer, if dpkg can remove a package straight away regardingless if there are some other packages dependent on the package being removed. Please correct me if I am wrong...
    – user251447
    Mar 2, 2014 at 13:45
  • apt is the newer and superior replacement to apt-get.
    – Humpity
    Feb 2 at 10:33

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .