All actions performed by apt
are logged in /var/log/apt/
but this too has excessive detail and many logs are compressed.
The following script produces a list of actions and the dates on which they were performed.
I have modified my apthist script to show only user installed packages.
#!/bin/bash
#Print apt-get history EXCEPT for upgrades
# 2017-08-06
# 2020-10-07 Include packages installed by packagekit
# 2020-12-04 delete lines containing 'apt upgrade' and preceding line
for logf in $(ls /var/log/apt/history.log..gz | sort -rV) ;
do zcat $logf | grep -E -A 1 "Start-Date:|Commandline:" | sed -e '/Requested-By:/d' ; done
| tac | sed -e '/^--/d' -e '/apt .upgrade/{N;d;}' | tac
Include most recent
grep -E -A 1 "Start-Date:|Commandline:" /var/log/apt/history.log | sed -e '/Requested-By:/d'
| tac | sed -e '/^--/d' -e '/apt .*upgrade/{N;d;}' | tac
- Below is a script I use to list apt history. This is still handy if you are interested in upgrades.
#!/bin/bash
# Print apt-get history
# 2020-10-07 Include packages installed by packagekit
for logf in $(ls /var/log/apt/history.log.*.gz | sort -rV) ; do zcat $logf | grep -E -A 1 "Start-Date:|Commandline:" | sed -e '/Requested-By:/d' ; done
# Include most recent# grep -E "Start-Date:|Commandline:" /var/log/apt/history.log
grep -E -A 1 "Start-Date:|Commandline:" /var/log/apt/history.log | sed -e '/Requested-By:/d'
There are some limitations;
- only the last 12 months are shown (because the logs are rotated
monthly and only the 12 most recent are kept) but this can be
extended by editing
/etc/logrotate.d/apt