6

I'm using Ubuntu20.04

I used the command sudo apt-get install gnome by mistake and gnome package was installed on my system, how to restore everything to its original state?

4 Answers 4

7

I've just tested sudo apt-get install gnome and then sudo apt-get purge gnome --autoremove on a fresh Ubuntu 20.04.1 LTS. It does not remove all of the dependencies which are dragged in by installing gnome because many of them are suggested by other installed packages.

Fortunately, on Ubuntu, apt keeps a log of what packages were installed and when. To see the log, it is enough to issue:

$ cat /var/log/apt/history.log

There you will find the list of packages grouped by install occurrence. Look for Commandline: apt-get install gnome. If you did not install or upgrade recently, it should be the last one.

To copy the list of packages for removal, you will want to pre-format them to strip the information in parentheses. You can do it with this useful script:

$ perl -pe 's/\(.*?\)(, )?//g' /var/log/apt/history.log

Then just copy the list of packages installed with gnome to your sudo apt purge command.

4

Run the following command in bash shell

sudo apt-get remove --purge gnome*

This will remove the every package in configuration file of gnome.

2
sudo apt-get purge gnome

should remove everything co-installed if you haven't changed the defaults.

Also see: https://askubuntu.com/questions/247549/is-it-possible-to-undo-an-apt-get-install-command

-1

You can't. But you can install another Desktop environment like apt-get install lxde and select that one from the login screen drop down box.

0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .