Ubuntu – Undo apt-get remove open* ubuntu 12.04


I am running a Linux instance on ec2, snap sorting of image is disabled.

While trying to un-install open-jdk from the system. I stupidly run the command

sudo apt-get remove open*

It started removing many packages, so I stopped the process by Ctrl+C.

I did it twice:

  • sudo apt-get remove open*
  • sudo apt-get remove openjdk*

I stopped the process (Ctrl+C) in between for both of them.

Now I see that my other application are not working, because of the packages removed.

Please advice, how can I go back to the state before apt-get remove.

Thanks in advance.

Best Answer

You can get the information about recently removed packages(What are all the packages that are recently removed) in /var/log/dpkg.log file along with the date and time.

awk '$3=="remove"' /var/log/dpkg.log 

Find and reinstall the packages via apt-get.