How can one remove all packages installed after a certain date/time?

On the 9th of November I tried installing the last stable release of BasKet Note Pads which apparently is not supported off the bat because it needs to be ported to QT4 and KDE 4, whatever that means. The program has been ported but it is, as of 2010, in beta phase meaning it is basically buggy and lacks the functionality that I need.

As such, I tried installing BasKet v1.x which needed QT3 and a bunch of other things I don't know much about. I tried installing them and ended up filling 20% of my 15 GB hard drive. Of course, I never got BasKet to work but the packages I installed are still there and now I need to effectively uninstall everything I installed that day.

Is there a command to uninstall all packages installed on a certain date (in my case, the 9th of November) ?


Specific date %yyyy-%mm-%dd replace on here,

grep "2015-12-19.*.install " /var/log/dpkg.log | awk '{ print $4 }' | cut -d: -f1

You get a list of packages,

libck-connector0
libgssrpc4
libkadm5clnt-mit9
libkdb5-7
libkadm5srv-mit9
libgnutlsxx27
....
....

Append them to the list of Apt command arguments with xargs:

grep "2015-12-19.*.install " /var/log/dpkg.log | awk '{ print $4 }' | cut -d: -f1 | xargs sudo apt-get --yes purge

Incase you know the dates on which you installed these packages, the best way I've found to remove them automatically is the below command :

grep "2015-12-19.*.install " /var/log/dpkg.log | awk '{ print $4 }' | cut -d: -f1 

The above will list all packages installed on the date in the command. The final command is :

grep "2015-12-19.*.install " /var/log/dpkg.log | awk '{ print $4 }' | cut -d: -f1 | sudo apt-get remove -y

Replace the date to your needs and you should be good to go !


You can see what packages you've installed in chronological order by doing:

grep install /var/log/dpkg.log

(the last entries will be the most recent)

On the left, you can find the installation date and time.

Pick what you wish to uninstall and do

sudo apt-get remove package-name

Also, as you have a small hard disk, I would recommend removing from your disk the Deb packages used for the installation of the programs:

sudo apt-get clean

This will remove the deb files from /var/cache/apt/archives/