How to get list of installed packages with installation date? [duplicate]
How can I output a list of all installed packages with installation date and additional information?
Solution 1:
Open Terminal and run:
zgrep 'install ' /var/log/dpkg.log* | sort | cut -f1,2,4 -d' '
Example output:
2018-09-02 16:10:59 python3-psutil:amd64
2018-09-02 16:11:00 menulibre:all
2018-09-07 14:58:58 indicator-stickynotes:all
2018-09-08 00:17:41 libdumbnet1:amd64
2018-09-08 00:17:41 libxmlsec1-openssl:amd64
...
Since this command will look up into all logs thus the output can be very big. So, it's better to save it into file using
zgrep 'install ' /var/log/dpkg.log* | sort | cut -f1,2,4 -d' ' > test.txt
Solution 2:
Here is a script that uses the files /var/log/dpkg.log*
to construct a list of currently installed packages together with the most recent installation date.
#!/bin/bash
LOGDIR=$(mktemp -d)
cd $LOGDIR
cp /var/log/dpkg.log* .
# grep the relevant lines from the log files
for file in dpkg.log*
do
zgrep ' install ' "$file" > ins.${file%.gz}
done
# Merge all the install lines chronologically into a single file
cat $(ls -rv ins.*) > install.log
# Construct a list of all installed packages in the format packagename:arch
dpkg -l | grep '^.i' | tr -s ' ' | cut -d' ' -f2,4 | tr ' ' : | cut -d: -f1,2 > installed.list
OUTFILE=$(mktemp -p .)
for package in $(< installed.list)
do
# Get only the most recent installation of the respective package
grep " $package" install.log | tail -n1 >> "$OUTFILE"
done
sort "$OUTFILE" > newest-installs.log
echo "List of installed packages written to ${LOGDIR}/newest-installs.log"
Solution 3:
Use
tail -f /var/log/dpkg.log
or
less /var/log/dpkg.log
or
grep " install " /var/log/dpkg.log*
zgrep " install " /var/log/dpkg.log.*.gz
can use grep for a particular package (example)
grep -E 'install .*<package-name>' /var/log/dpkg.log*