I have tried searching for this but there seems to be no command that can output a list of packages (ideally in Ubuntu) that I have installed, not including any dependencies.

aptitude search '~i!~M!~E!~prequired!~pimportant'

will list all the packages which have been installed without being marked as automatically installed, excluding essential and required packages, which is pretty much what you're looking for. ~i lists packages which are installed, !~M filters packages which are marked as automatically installed, !~E filters essential packages, !~prequired and !~pimportant filter required and important packages. The latter three filters will catch quite a few packages installed by default.

On Ubuntu, you can add !~Rubuntu-desktop!~Rrecomends:ubuntu-desktop to filter out all the packages which ubuntu-desktop depends on or recommends, and which are installed by default:

aptitude search '~i!~M!~E!~prequired!~pimportant!~Rubuntu-desktop!~Rrecommends:ubuntu-desktop'
  • 2
    It seems this will also list packages installed as part of the initial OS installation which I suspect warsong would want to avoid being reported. – jlliagre Mar 16 '15 at 22:00
  • True, I'll edit to exclude essential packages and so on... – Stephen Kitt Mar 16 '15 at 22:02
comm -23 <(apt-mark showmanual | sort -u) \
         <(gzip -dc /var/log/installer/initial-status.gz |
           sed -n 's/^Package: //p' | sort -u)

This gets the correct list of user-installed packages, to a better approximation than the answer from @Stephen Kitt.

  • FWIW: Not complaining at all, just leaving a comment FYI: Neither of the answers posted give the correct result on my Raspberry Pi (3B+, Raspbian stretch) – Seamus Apr 6 '19 at 16:28

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.