sıx 2017-10-12 21:19:39 +02:00 committed by GitHub
parent dc30ff2c11
commit 6ed9490982
1 changed files with 19 additions and 0 deletions

View File

@ -0,0 +1,19 @@
# -*- coding: utf-8 -*-
# I am not reading /var/log/messages because it needs root.
# Therefore I chose another file which allows read for standard user: dpkg.log
# I am reading the fully installed packages from dpkg.log.
for line in open("/var/log/dpkg.log"):
if " installed" in line:
print line
# Other way of doing this
file_descriptor = open("/var/log/dpkg.log", "r")
for line in file_descriptor:
if " installed" in line:
#print line # prints full lines
print line.split()[4]