Skip to main content
Add restrictions to the answer
Source Link
lbs
  • 59
  • 3

Automatic packages that are no longer used are marked as "id" in aptitude.

I find three ways to remove them.

  1. Aptitude UI

    sudo aptitude

    Press g to preview packages to be installed and removed.

    enter image description here

    You can find those packages under "Packages being removed because they are no longer used". Then press g again, aptitude will remove those packages.

  2. Aptitude command line with grep and xargs

    aptitude search ~i | grep ^id | awk '{print $2}' | xargs sudo aptitude purge -y

  3. Aptitude command line with Aptitude::Delete-Unused option

    sudo aptitude -o Aptitude::Delete-Unused=1 install

    Option: Aptitude::Delete-Unused

    Default: true

    Description: If this option is true, automatically installed packages which are no longer required will be automatically removed. For more information, see the section called “Managing automatically installed packages”.

    I found this solution from http://www.lambdacurry.com/2013/12/aptitude-equivalent-of-apt-get-autoremove/. And the option is described in "Configuration file reference" in the aptitude reference manual. I don't have enough reputation to post more links, so you can search around for the document.

Either of them works for me.

According to 6.2.7. Tracking Automatically Installed Packages:

With this information, when packages are removed, the package managers can compute a list of automatic packages that are no longer needed (because there is no “manually installed” packages depending on them).

and Managing automatically installed packages:

More precisely: they will be removed when there is no path via Depends, PreDepends, or Recommends to them from a manually installed package.

My answer applies only when there is no path of dependency (Depends, PreDepends, or Recommends) from a manually installed package to the target package. Thus there is no means of using aptitude to do the same thing as apt-get autoremove does in the situation described in the question (there exists a dependency path from ubuntu-gnome-desktop).

Automatic packages that are no longer used are marked as "id" in aptitude.

I find three ways to remove them.

  1. Aptitude UI

    sudo aptitude

    Press g to preview packages to be installed and removed.

    enter image description here

    You can find those packages under "Packages being removed because they are no longer used". Then press g again, aptitude will remove those packages.

  2. Aptitude command line with grep and xargs

    aptitude search ~i | grep ^id | awk '{print $2}' | xargs sudo aptitude purge -y

  3. Aptitude command line with Aptitude::Delete-Unused option

    sudo aptitude -o Aptitude::Delete-Unused=1 install

    Option: Aptitude::Delete-Unused

    Default: true

    Description: If this option is true, automatically installed packages which are no longer required will be automatically removed. For more information, see the section called “Managing automatically installed packages”.

    I found this solution from http://www.lambdacurry.com/2013/12/aptitude-equivalent-of-apt-get-autoremove/. And the option is described in "Configuration file reference" in the aptitude reference manual. I don't have enough reputation to post more links, so you can search around for the document.

Either of them works for me.

Automatic packages that are no longer used are marked as "id" in aptitude.

I find three ways to remove them.

  1. Aptitude UI

    sudo aptitude

    Press g to preview packages to be installed and removed.

    enter image description here

    You can find those packages under "Packages being removed because they are no longer used". Then press g again, aptitude will remove those packages.

  2. Aptitude command line with grep and xargs

    aptitude search ~i | grep ^id | awk '{print $2}' | xargs sudo aptitude purge -y

  3. Aptitude command line with Aptitude::Delete-Unused option

    sudo aptitude -o Aptitude::Delete-Unused=1 install

    Option: Aptitude::Delete-Unused

    Default: true

    Description: If this option is true, automatically installed packages which are no longer required will be automatically removed. For more information, see the section called “Managing automatically installed packages”.

    I found this solution from http://www.lambdacurry.com/2013/12/aptitude-equivalent-of-apt-get-autoremove/. And the option is described in "Configuration file reference" in the aptitude reference manual. I don't have enough reputation to post more links, so you can search around for the document.

Either of them works for me.

According to 6.2.7. Tracking Automatically Installed Packages:

With this information, when packages are removed, the package managers can compute a list of automatic packages that are no longer needed (because there is no “manually installed” packages depending on them).

and Managing automatically installed packages:

More precisely: they will be removed when there is no path via Depends, PreDepends, or Recommends to them from a manually installed package.

My answer applies only when there is no path of dependency (Depends, PreDepends, or Recommends) from a manually installed package to the target package. Thus there is no means of using aptitude to do the same thing as apt-get autoremove does in the situation described in the question (there exists a dependency path from ubuntu-gnome-desktop).

Source Link
lbs
  • 59
  • 3

Automatic packages that are no longer used are marked as "id" in aptitude.

I find three ways to remove them.

  1. Aptitude UI

    sudo aptitude

    Press g to preview packages to be installed and removed.

    enter image description here

    You can find those packages under "Packages being removed because they are no longer used". Then press g again, aptitude will remove those packages.

  2. Aptitude command line with grep and xargs

    aptitude search ~i | grep ^id | awk '{print $2}' | xargs sudo aptitude purge -y

  3. Aptitude command line with Aptitude::Delete-Unused option

    sudo aptitude -o Aptitude::Delete-Unused=1 install

    Option: Aptitude::Delete-Unused

    Default: true

    Description: If this option is true, automatically installed packages which are no longer required will be automatically removed. For more information, see the section called “Managing automatically installed packages”.

    I found this solution from http://www.lambdacurry.com/2013/12/aptitude-equivalent-of-apt-get-autoremove/. And the option is described in "Configuration file reference" in the aptitude reference manual. I don't have enough reputation to post more links, so you can search around for the document.

Either of them works for me.