How to clear the APT cache and delete everything from /var/cache/apt/archives/

The clean command 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/. The syntax is:

sudo apt clean
or
sudo apt-get clean

Delete all useless files from the APT cache
The syntax is as follows to delete /var/cache/apt/archives/:

sudo apt autoclean
or
sudo apt-get autoclean

Verify that files are removed from /var/cache/apt/archives/ safely using the du command:

sudo du -ch /var/cache/apt/archives/

This explained APT cache and how to use the clean and autoclean apt-get command that clears out the downloaded package files from/var/cache/apt/archives/ folder. In short, use the sudo apt clean
 and sudo apt autoclean
 to free up disk space as part of scheduled maintenance on your Debian or Ubuntu Linux server.

Leave a Comment

Your email address will not be published. Required fields are marked *