Ubuntu – How do “apt-get clean” and “apt-get clean all” differ

aptcommand line

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?

Best Answer

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
Related Question