103

What, if anything, is the difference between this command:

sudo apt-get clean

And this command:

sudo apt-get clean all

On my Lubuntu 12.04 system, simulating these commands reveals their behavior to be exactly the same:

ek@Apok:~$ apt-get -s clean
NOTE: This is only a simulation!
      apt-get needs root privileges for real execution.
      Keep also in mind that locking is deactivated,
      so don't depend on the relevance to the real current situation!
Del /var/cache/apt/archives/* /var/cache/apt/archives/partial/*
Del /var/cache/apt/pkgcache.bin /var/cache/apt/srcpkgcache.bin
ek@Apok:~$ apt-get -s clean all
NOTE: This is only a simulation!
      apt-get needs root privileges for real execution.
      Keep also in mind that locking is deactivated,
      so don't depend on the relevance to the real current situation!
Del /var/cache/apt/archives/* /var/cache/apt/archives/partial/*
Del /var/cache/apt/pkgcache.bin /var/cache/apt/srcpkgcache.bin
ek@Apok:~$

Is there ever any difference in apt-get's behavior with clean and clean all? If so, what is the difference, under what circumstances is it relevant, and how should I choose between the two? If there is no difference, then why does clean all exist?

If they're the same, then clean all would still make sense if clean could ordinarily take a package name as an argument. But this is not the case--attempting to pass a package name to clean doesn't alter clean's behavior at all, the whole cache still gets deleted:

ek@Apok:~$ apt-get -s clean nano
NOTE: This is only a simulation!
      apt-get needs root privileges for real execution.
      Keep also in mind that locking is deactivated,
      so don't depend on the relevance to the real current situation!
Del /var/cache/apt/archives/* /var/cache/apt/archives/partial/*
Del /var/cache/apt/pkgcache.bin /var/cache/apt/srcpkgcache.bin

This does make me wonder, though, if perhaps clean all doesn't really exist (and that what's happening is that all is ignored, just as nano was in the above example).

Is clean all just an urban legend?

Seth
  • 58,122
Eliah Kagan
  • 117,780

1 Answers1

208

In

sudo apt-get clean all

all is just ignored, like anything else you append after clean.

It's the same with for example

sudo apt-get clean my room
  • 6
    Is (or was) there any documentation that recommended clean all? How did the practice of running sudo apt-get clean all arise? Did the behavior used to be different? Or is running clean all just a confusion, perhaps arising from somewhat similar make syntax? – Eliah Kagan May 30 '12 at 17:58
  • 1
    I've never seen any documentation recommending apt-get clean all. I guess it's a confusion with make or something similar. – Florian Diesch May 30 '12 at 18:09
  • 4
    When I search for apt-get clean all on Google, there are 48,900 results (though, admittedly, the first two are for this question). On the other hand, the manual page hasn't said anything about it, and I can't find any official sources that recommend using it. I'd like to know more about how this arose...but I suspect that might take considerable time and effort. – Eliah Kagan May 30 '12 at 18:12
  • 3
    A messy room/desk gnawing on your subconscious, @EliahKagan? :P – ish May 30 '12 at 20:21
  • 14
    The affectation of adding the "all" is most likely a hangover from "yum clean all" –  Jan 31 '15 at 01:29
  • 2
    guys what about man apt-get ? – Postadelmaga Sep 18 '15 at 12:35
  • 26
    +1 for sudo apt-get clean my room XD – ckhatton Sep 19 '16 at 11:43
  • Tried to clean my room… didn't do anything :( – HerpDerpington Jun 04 '18 at 20:42