O Apt pode fazer isso com as opções clean e autoclean.
clean
clean clears out the local repository of retrieved package
files. It removes everything but the lock file from
/var/cache/apt/archives/ and /var/cache/apt/archives/partial/ ....
autoclean
Like clean, autoclean clears out the local repository of retrieved
package files. The difference is that it only removes package files
that can no longer be downloaded, and are largely useless....