Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

This question already has an answer here:

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?

share|improve this question

marked as duplicate by Eric Carvalho, souravc, Caesium, Ask, LnxSlck Mar 3 at 12:16

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

    
@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. –  Eliah Kagan Mar 3 at 2:10
    
The real answer to this question, with detail on apt-get remove and apt-get purge. –  BobStein-VisiBone Oct 16 at 15:42

1 Answer 1

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.

share|improve this answer
    
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 at 13:35
    
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 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 at 13:45

Not the answer you're looking for? Browse other questions tagged or ask your own question.