When you install packages in Debian/Ubuntu using the apt-get command, a copy of the .deb file is locally stored. This helps in case you need to reinst

How to Clear Apt Cache

submited by
Style Pass
2021-06-19 15:25:20

When you install packages in Debian/Ubuntu using the apt-get command, a copy of the .deb file is locally stored. This helps in case you need to reinstall them after removal, then packages can be accessed locally (in another way called cache). Each time when you reinstall, the system doesn't need to go through the network.

Downloaded package are locally cached in /var/cache/apt/archives/. Each time when you run apt-get update and apt-get install command, the apt cache is updated.

Note: If you are using apt command, instead of apt-get command then this cache is automatically deleted in the new OS versions.

To clean apt cache use apt clean command, which removes everything (except the lock file) from /var/cache/apt/archives/ and /var/cache/apt/archives/partial/.

Its safe to run apt-get clean command as its only removes a copy of .deb files. Next time when you run apt-get install it can fetch packages from mirror.

Leave a Comment