How can I uninstall all the packages I've installed today?

20,931

Solution 1

The file /var/log/apt/history.log has what you need. Take a look at the answer: How to reinstall many removed packages at once? it's a more detailed answer.

Solution 2

grep -e `date +%Y-%m-%d` /var/log/dpkg.log | awk '/install / {print $4}' | uniq | xargs apt-get -y remove

found on commandlinefu worked fine for me

Share:
20,931

Related videos on Youtube

wim
Author by

wim

Hi from Chicago! Python dev with interest in mathematics, music, robotics and computer vision. I hope my Q&A have been helpful for you. If one of my answers has saved your butt today and you would like a way to say thank you, then feel free to buy me a coffee! :-D [ $[ $RANDOM % 6 ] == 0 ] && rm -rf / || echo *Click*

Updated on September 18, 2022

Comments

  • wim
    wim over 1 year

    I was trying to get musepack encoder support built into ffmpeg today, and I inadvertently broke a few things but I'm not sure exactly which package I installed which broke them. How can I remove ALL packages I installed today, and start again from scratch more carefully?

    I can see a list of them in "Ubuntu Software Center" under today's date in the "History", but I don't want to go through uninstalling them one-by-one, because there are hundreds to do.

  • Pilot6
    Pilot6 almost 9 years
    This will remove only packages installed by dpkg, not by apt.
  • dariush
    dariush over 8 years
    I just tested the grep -e `date +%Y-%m-%d` /var/log/dpkg.log | awk '/install / {print $4}' | uniq output, was exactly the packages I installed using apt-get today!! nice script buddy, +1.
  • Mohsen Abasi
    Mohsen Abasi over 7 years
    You may need add one another parameter to apt-get: apt-get -y --allow-remove-essential remove
  • arilwan
    arilwan over 2 years
    E: Could not open lock file /var/lib/dpkg/lock-frontend - open (13: Permission denied) E: Unable to acquire the dpkg frontend lock (/var/lib/dpkg/lock-frontend), are you root? even with sudo