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.

By mistake I forgot to add --no-install-recommends flag to my apt-get install command, is there a way to purge those recommended packages after they've been installed?

share|improve this question

2 Answers 2

up vote 7 down vote accepted

In addition to enzotibs answer, if you wish to avoid adding --no-install-recommends each time, you can also disable automatic installation of recommended package by setting the APT::Install-Recommends setting to 0:

umask 0022;echo 'APT::Install-Recommends "0";' | \
    sudo tee /etc/apt/apt.conf.d/00DisableInstallRecommends

The umask 0022 causes the file to be created with permissions 644, restrictive permissions breaks operations like apt-get -s ... (simulate).

share|improve this answer

I think the sequence

sudo apt-get purge $packages
sudo apt-get autoremove
sudo apt-get --no-install-recommends install $packages

is the way to go.

share|improve this answer
3  
No reason to purge first. sudo apt-get --no-install-recommends reinstall $packages && sudo apt-get autoremove –  Barafu Albino May 3 '11 at 8:09
    
Barafu, that's the way to go, I think. Post an answer so I may accept. –  Oxwivi May 3 '11 at 8:12
1  
@Barafu Albino: apart from the fact that reinstall is wrong, maybe you mean --reinstall install, but even when corrected, it don't seem to work, from my tests. –  enzotib May 3 '11 at 8:13
    
Ok, I should add that my test are on 10.10, cannot test at the moment on 11.04. –  enzotib May 3 '11 at 8:16

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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