DEV Community

Mir Habib Ul Latif
Mir Habib Ul Latif

Posted on

A day with Linux-2: How to undo apt-get autoremove

Well i am trying to install gh cli in my ubuntu 20LTS but get dpkg error because there is a name conflict between gh and gitsome and in this issue they suggest me to remove gitsome (if i am not using it), so when i
sudo apt remove gitsome i accidentally type sudo apt autoremove which remove most of my python3 package.Then i realize what i have done,so to recover my python3 package i run the following command

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
Enter fullscreen mode Exit fullscreen mode

Reference:https://askubuntu.com/questions/738984/how-to-undo-apt-get-autoremove

Top comments (1)

Collapse
 
saulpalv profile image
Saul Alonso Palazuelos

docker installation saviour