3

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?

maze
  • 143

1 Answers1

2

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:
  default.append(line.split('\t')[0])

f2 = open('installed', 'r')
installed = []
for line in f2:
  installed.append(line.split('\t')[0])

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

print("\n".join(extras))

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.

Anwar
  • 77,855