0

I want a list of installed software, those not installed as dependencies of others. So for example I want to see gvim but exclude gvim-data and gvim-common which are dependencies of gvim

Of course I don't want to include release soft in the list.

I also want to see the installed time.

It seems aptitude can do this partially.

Zanna
  • 72,312
eexpress
  • 269

1 Answers1

0

I filtered the /var/log/apt/history.log file for this purpose.

A record in the file looks like:

Start-Date: 2016-12-14  18:28:01
Commandline: synaptic
Requested-By: user (1000)
Install: libglib2.0-bin:amd64 (2.48.1-1~ubuntu16.04.1, automatic) libglib2.0-dev:amd64 (2.48.1-1~ubuntu16.04.1)
End-Date: 2016-12-14  18:28:06

Package names with "automatic" are dependencies (libglib2.0-bin in the example) and without "automatic" are installed by command (libglib2.0-dev).

I found this code in my archives and probably it works

#!/usr/bin/env python
# -*- coding: utf-8 -*-
import re
import sys

for arg in sys.argv[1:]:
  fil = open(arg)
  for line in fil:
    ma = re.match(r'Install: (.*)', line)
    if ma:
      grp = ma.groups()[0]
      lst = re.split(r'\), *', grp)
      for item in lst:
        if item.endswith(', automatic'):
          continue
        else:
          name = item.split(':')[0]
          print dte, name
    ma = re.match(r'Start-Date: ([^ ]*)', line)
    if ma:
      dte = ma.groups()[0]
  fil.close()
alpo
  • 21