27

When upgrading to version 15.04 from 14.10 there was a "clean up" time period where I received a query to eliminate 18 unused or unnecessary packages. Can anyone show me where I can make sure that I don't have any superfluous unused packages?

3 Answers 3

30

First you should know our systems is not that smart !! A system can't know which package is needed by you or not. Ubuntu can't remove any package that were installed by the user himself, instead it offers you to delete the packages that were downloaded as dependencies for other packages and not used anymore, which means those packages were installed by the system itself and not by the user...

man apt-get

 autoremove
           autoremove is used to remove packages that were automatically
           installed to satisfy dependencies for other packages and are now no
           longer needed.

So running sudo apt-get autoremove will uninstall the unused packages which were used as dependencies for other packages.

A system can show you the Important or required packages so those is not supposed to be removed.

Install aptitude if you don't have it:

sudo apt-get install aptitude

Now you can search for packages considered required:

aptitude search '~prequired'

or important:

aptitude search '~pimportant'

How To know The unused packages in Ubuntu

There is a bash script for a tool called unusedpkg, this can test since when you didn't use the packages so you can determine what to delete.

Download the script. Extract the zipped folder then give permission to the script

chmod +x unusedpkg

Now you can run it from dir containing the script

$./unusedpkg 

Sample output:

* UnusedPkg 0.6
  Find unused packages in your Linux system.

WARNING:
   Idle days may be wrong. Before delete anything, check package timestamps
   using 'unusedpkg info <package>', or manually with 'ls -alu'. View README for infos.

Minimum packages size: 1MB

IDLE DAYS   SIZE    PACKAGE NAME
1 year and 6 months      (553 days)     8MB 0ad 
1 year and 6 months      (553 days)     2MB gnect 
1 year and 6 months      (553 days)     1MB libgvc5 
1 year and 6 months      (553 days)     8MB locales 
21

These tips might be helpful to clean up your system and remove unused packages

sudo apt-get autoclean to clean up outdated package deb files

sudo apt-get autoremove to remove any unused dependencies

sudo apt-get clean to clean up apt cache

Do man apt-get to get more info on apt-get and how to use it.

1
  • Description of every command is incorrect, sudo apt-get autoclean to remove cached outdated package's deb files, sudo apt-get autoremove to remove unused dependencies, sudo apt-get clean to remove all deb file cached by apt. Jan 15, 2021 at 12:25
9

To removes packages that were installed by other packages and are not needed anymore run:

sudo apt-get autoremove

To remove .deb files for packages which are no longer installed run:

sudo apt-get autoclean

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.