How to undo apt-get autoremove

Solution 1:

I don't Know if there is any simpler way but if you look at /var/log/apt/history.log you can see what was removed. Just reinstall each package that was removed.

Using this may save your time

echo '#!/bin/bash' > restore
echo sudo apt-get install `grep Remove /var/log/apt/history.log | tail -1 | sed -e 's|Remove: ||g' -e 's|([^)]*)||g' -e 's|:[^ ]* ||g' -e 's|,||g'` >> restore
chmod +x restore 
./restore