clean, autoclean, and autoremove --- combining them is a good step?
122,876
This completely depends on what you want to achieve, they are separate for a reason. But lets see what they actually do:
-
apt/apt-get clean
→ cleans the packages and install script in/var/cache/apt/archives/
-
apt/apt-get autoclean
→ cleans obsolete deb-packages, less thanclean
-
apt/apt-get autoremove
→ removes orphaned packages which are not longer needed from the system, but not purges them, use the--purge
option together with the command for that.
So it is up to you to decide if you want to combine one of the first two with the last one and you can do this like below:
sudo apt autoremove && sudo apt clean
If thats what you really want to do, but now to code an extra command for it is pretty superfluous to be honest.
Further reading material:
- manpage for the
apt
command - manpage for the
apt-get
command - What is difference between the options “autoclean”, “autoremove” and “clean”?
Related videos on Youtube
Author by
Arcticooling
Updated on September 18, 2022Comments
-
Arcticooling over 1 year
Will it be logical by means of Debian oriented logic to unite the three commands
apt-get clean
andapt-get autoclean
, andapt-get autoremove
into one single command that does all of them?-
Chai T. Rex over 6 yearsWhat "Debian oriented logic" are you referring to?
-
Arcticooling over 6 yearsCommon logic in Debian systems like Debian and Ubuntu. The logic comes out in syntax, commands, terminology, etc.
-
-
dessert over 6 yearsI defined an alias for
sudo bash -c "apt-get update && apt-get -y upgrade && apt-get -y autoremove && apt-get -y clean"
and it serves me well. Caution:autoremove
removes old kernel images. -
Arcticooling over 6 yearsIf I understood your answer correctly, you mean to say that
sudo apt-get autoremove && sudo apt-get clean
covers everything insudo apt-get autoclean
? -
Videonauth over 6 yearsExactly, autoclean only removes files out out the archives which can no longer be downloaded, clean nukes the archives completely.