↑ ↓ select, Enter open, Esc close

Delete downloaded package files from the apt cache

Caution: This command changes the system. Understand what it does before you run it.

root@server
du -sh /var/cache/apt/archives && apt clean

First shows how much space the downloaded .deb files under /var/cache/apt/archives take up, then deletes them. Installed packages are not affected, apt simply downloads the files again when needed. Useful as a quick space gain when the root partition fills up.

Note: apt autoclean only deletes package files that are no longer available in the sources, making it the more conservative option.

Also searched as

  • apt clean cache
  • var cache apt is full
  • free up space on root partition

Related one-liners

All in Debian and APT

Read first, then run.

The commands on myline.de act directly on servers, files and databases. A wrong path or placeholder can delete data irreversibly or make a server unreachable.

  • All commands are provided without warranty and are not tested on every system.
  • Understand what a command does before running it, and check every placeholder.
  • Make a backup first and, if possible, try it on a test system.
  • You run commands at your own risk. Liability for damages is excluded to the extent permitted by law.