In this article, we cover the difference between apt clean & apt autoclean in Ubuntu. Both the options i.e. clean and autoclean of apt are used to clear local repository. The .deb files are stored in local repository –
So, when we install any package the installation tool first looks for the packages in local repository and if the package isn’t available there. Then, it downloads the package from online repository. Sooner or later the packages in local repository starts to build up, which we may have to deal with at some point in time.
We next discuss the difference between apt clean and apt autoclean. Both the options are linked with package files stored in the local repository.
Note: Following operations require you to have superuser privileges. In case you don’t have one then we advise you to contact your System Administrator for assistance.
Difference between apt clean & apt autoclean in Ubuntu
If you want to remove all the packages files stored in the local repository. Then, use clean option with apt. It removes everything from the
/var/cache/apt/archives/partial directory except the
lock file in
/var/cache/apt/archives. Open a terminal and issue the following –
sudo apt clean
On the other hand, we have autoclean option. It also will clear the local repository. But, there is a subtle difference. With autoclean option, we can remove all those packages which are not required by the system or which cannot be downloaded any further. This way we can manage our repository to any extent. If you want to use autoclean option then issue the following in terminal –
sudo apt autoclean
In short, the basic difference between apt clean and apt autoclean – with apt clean we can clear everything from the local repository whereas with apt autoclean only those package files stay which are needed by the operating system.
In conclusion, we have covered difference between apt clean and apt autoclean in Ubuntu here.
Additional Info –
If you would like to know more about about apt clean. apt remove is something we want to add here. The following command –
sudo apt autoremove
is used to remove those packages which are installed as dependencies while installing any package and are no longer needed. The functioning of autoremove option is entirely different from clean and autoclean options of apt.