This question already has an answer here:

is there a way to get a list of all the package names I have installed additionally to those that shipped with my copy of Ubuntu?

I didn't find options under the manual files of apt, dpkg and apt-get that seemed like they could do this kind of function.

EDIT to clarify: assuming Ubuntu came with packages a,b,c,d,e,f and I manually installed packages x,y,z, how can I get a list of x,y,z?

marked as duplicate by Ron, Eric Carvalho, WinEunuuchs2Unix, TheWanderer, Kaz Wolfe Oct 29 '16 at 1:10

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • 6
    Do a minimum research before asking, or if you did, make clear what you have tried, even if that didnt work out askubuntu.com/questions/2389/… – M. Becerra Oct 28 '16 at 15:09
  • @M.Becerra manually and automatically is different things than the question OP asked. Ubuntu mark all packages it installed by default as manual and that is not going to help – Anwar Oct 28 '16 at 15:41
  • 1
    @M.Becerra thank you, the commands in the answer there seem to be what i needed. I tried searching but had difficulty phrasing myself so resorted to making my own question; sorry/thanks! – maze88 Oct 28 '16 at 15:55
  • I'm voting this to reopen because, I think this is not a duplicate of the linked question. Reasons are 1. apt's manual and automatic are not same as manually installed by me and automatically installed by default. These are very different. – Anwar Oct 29 '16 at 8:48
  • @maze88 What do you mean by "I manually installed". Manually has two meanings in Apt world. If you install a package A and it brings B, C as dependencies, Only A is marked as manually installed. You want to see all A,B,C in the output or only the A? – Anwar Oct 29 '16 at 13:16

I believe there are better ways to do this, but this works.

First download the Ubuntu manifest file for your Ubuntu release

wget -c "releases.ubuntu.com/$(lsb_release -r -s)/ubuntu-$(lsb_release -r -s)-desktop-$(dpkg --print-architecture).manifest" -O ubuntu.manifest

Then generate the list of packages you have in your system and save it in a file called installed

dpkg-query -W -f='${binary:Package}\t${Version}\n' > installed

Then copy and paste this python code to a file naming pkg-diff.py (or whatever name you want)

f = open('ubuntu.manifest', 'r')

default = []
for line in f:

f2 = open('installed', 'r')
installed = []
for line in f2:

extras = list(set(installed) - set(default))


Finally execute the python script using the command in a terminal.

python3 ./pkg-diff.py

It should give you the list of packages you installed additionally.

Note: All files should be in same directory.

  • Cool solution! ;-) – Fabby Oct 28 '16 at 22:44
  • @Fabby Thanks for the encouragement :) – Anwar Oct 29 '16 at 8:10

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