Ever have a need to show a list of what packages were installed (or recently installed) by date on Ubuntu?
Say you are troubleshooting a problem and need to back-track on when a package was installed. Or if you are a Windows user who has switch to Ubuntu and is not familiar with how to check when a package was installed.
Fortunately there are a few ways to find out. In this article, we'll look at how to view installed packages by date using Synaptics Package Manager and from the command prompt using a Terminal window.
Using Synaptics Package Manager
To open Synaptics, on the top panel, click on System \ Administration \ Synaptics Package Manager.
If prompted, enter your password to proceed.
Once Synaptics Package Manager opens, from the menu, click on File \ History.
In the history window, you will see the dates of when packages were installed. Just click on the arrow next to the date to expand the list, then click on the date to view what packages (and their dependency) were installed on that day.
If you have a larger list (than mine), you can also search for packages using the Find search at the bottom.
Using Terminal Window
If you prefer to work at the command prompt, open a Terminal window by clicking on Application \Accessories \ Terminal.
At the prompt, you can view installed packages by date, by viewing the /var/log/dpkg.log file using the following command:
cat /var/log/dpkg.log | grep "\ install\ "
The dpkg.log file will rotate and archive weekly (for more information on log rotating see Ubuntu Guide For Windows Users: Manage Log File Size). If you don't see previous dates, then list the contents of the /var/log directory for dpkg log files that may exist.
To list the content of a directory, use the following command:
ls -l /var/log
To list just dpkg.log files, use the following command:
ls -l /var/log/dpkg*
Now that you know how to view installed packages by date, switching over to Ubuntu for Windows users should be a little less intimitading.
Comments on Display The List Of Recently Installed Packages By Date On Ubuntu
You've got a typo in your last command - /vat for /var.
On RPM-based distros:
rpm -qa -last
gives you the list of all packages sorted by installation date. You can chop it up with head and tail to just look at a bit of it (e.g. rpm -qa -last | head -50 will show you the last 50 installed packages).
@Adam Williamson - thanks for spotting the error. I have corrected it.
Also, nice tip for using rpm to list packages by installation date.
Useful, but you have a UUoC (http://en.wikipedia.org/wiki/Cat_(Unix)#Useless_use_of_cat)
Also, no need to use backslashes to quote the spaces around "install":
grep " install " /var/log/dpkg.log
@Wodin
Old habits are hard break 😉 Thanks for the tip with grep.
The Synaptics tip is a good one. I rarely do an active investigation of all the options in the packages I use - even those I use frequently! Thanks.
Also: http://mavior.eu/apt-log/
apt-mark showauto >/tmp/auto.pkgs
## ASSUMING your dpkg Logs go back to the initial machine install (May NOT work across dist-upgrades)
## Create a full dpkg timeline log
cp /dev/null /tmp/dpkg.full
for LOG in $(ls -rt /var/log/dpkg.log.[0-9].gz /var/log/dpkg.log.1[0-9].gz)
do
test -e $LOG && gunzip -c $LOG>> /tmp/dpkg.full
done
for LOG in $(ls -rt /var/log/dpkg.log /var/log/dpkg.log.[0-9] /var/log/dpkg.log.1[0-9])
do
test -e $LOG && cat $LOG >>/tmp/dpkg.full
done
awk -v initialinstall=1 '
/ install grub-pc / {initialinstall = 0; next;}
/ install / {if ( initialinstall == 0) print $4;}
' /tmp/dpkg.full | grep -vf /tmp/auto.pkgs >~/iInstalled.pkgs
Thanks for the terminal version of this, helped me clean a lot of mess which I installed today 🙂