Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

How do you find all packages that were manually installed which are not a dependency of any other installed packages?

share|improve this question
up vote 3 down vote accepted

The short answer is: use aptitude like in the following:

aptitude -F%p search '?installed?not(?automatic)

But unfortunately this command returns many packages that match the query but are not what you expect, for two reasons:

  1. there are packages installed during initial installation of the system that result as non automatically installed

  2. packages installed as dependencies of a metapackage also can result as non automatically installed

The solution I came to some time ago is a match between the preceding command and the dpkg logs, that at least try to remove the influence of the point 1. in the preceding problems' list:



eval $(lesspipe)

vars=($(less $(ls -rt /var/log/dpkg.log*) | grep 'status installed grub-pc' | head -1))

join \
  <(aptitude -F%p search '?installed?not(?automatic)' |
    sort) \
  <(less $(ls -rt /var/log/dpkg.log*) |
    awk -v date=$date -v time=$time '(($1 == date && $2 > time) || $1 > date) && $3 == "install" { print $4, $1, $2 }' |
    sort -u) |
  awk '{ print $2, $3, $1 }' |

This assume that grub-pc is the last package installed during initial installation, and is in no way perfect, but can give you a rough information to start from.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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