# APT package cache (apt clean and autoclean)

> Where APT keeps downloaded .deb files, how apt clean, autoclean and autoremove differ, and what is safe to remove on Debian and Ubuntu.

The APT package cache is the folder /var/cache/apt/archives, where apt and apt-get keep downloaded .deb package files on Debian, Ubuntu and related distributions. 'apt-get clean' removes all cached packages, 'apt-get autoclean' removes only those that can no longer be downloaded, and 'apt autoremove' removes packages that nothing needs any more.

## What each command does

clean removes everything except the lock file from /var/cache/apt/archives and its partial folder. The packages remain installed; only the downloaded copies go.

autoclean deletes cached package files that are no longer available in the repositories, which keeps the cache from growing forever.

autoremove uninstalls packages that were installed automatically as dependencies and are no longer required, such as old kernels on Ubuntu.

## Seeing the size

'du -sh /var/cache/apt/archives' shows how much space the cache uses.

## How to clean the APT cache

1. Check the size: du -sh /var/cache/apt/archives
2. Remove all cached packages: sudo apt-get clean
3. Review what would be removed: apt-get -s autoremove
4. If the list looks right: sudo apt autoremove

## Cautions

- Read the autoremove list before confirming: a package you use can be listed if it was installed only as a dependency.
- Keep at least one older kernel you know boots.

## Sources

- [apt-get(8) (Debian)](https://manpages.debian.org/bookworm/apt/apt-get.8.en.html)
- [apt(8) (Debian)](https://manpages.debian.org/bookworm/apt/apt.8.en.html)

Last updated: 2026-10-08
URL: https://raincleaner.eu/wiki/linux/apt-cache-cleanup
