====== Ubuntu - apt-get - Clean the system ======
Free up some disk space.
----
===== Remove all packages from the package cache =====
sudo apt-get clean
**NOTE:** This may not be desirable if you have a slow Internet connection, since it will cause you to re-download any packages you need to install a program.
* The package cache is in **/var/cache/apt/archives**.
* See how much space cached packages are consuming:
du -sh /var/cache/apt/archives
----
===== Only remove packages that have a newer version available =====
sudo apt-get autoclean
**NOTE:** **autoclean** only removes those retrieved package files that have a newer version now, and so will not be used anymore.
* This command removes **.deb** files for packages that are no longer installed on your system.
* Depending on your installation habits, removing these files from /var/cache/apt/archives may regain a significant amount of diskspace.
----
===== Removes libraries and packages that were installed automatically to satisfy the dependencies of another installed package =====
sudo apt-get autoremove
**NOTE:** **autoremove** removes libraries and packages that were installed automatically to satisfy the dependencies of another installed package.
* If that package is removed, these automatically installed packages are useless in the system, and this command removes such packages.