Score:0

What is the safest and most efficient way to remove multiple applications installed by 'sudo apt install gnome-*'?

me flag

I Accidentally ran sudo apt install gnome-* in terminal and a lot of applications were installed in my system. I would like to know if there is a way to get rid of all those apps that were installed by the command. Is there any way to sort by date and remove the unwanted apps?

Is it safe to run sudo apt remove gnome-*?

user535733 avatar
cn flag
Well, It's "safe" in the sense that it probably won't burn down your home. But it will certainly remove your entire Gnome desktop, which some folks might consider quite catastrophic and emotionally wrenching. It's compounding your first bad decision (sorry, I mean "accident") with another bad decision.
us flag
If you accidentally remove the desktop environment, you can restore it with `sudo apt install ubuntu-desktop^`
guiverc avatar
cn flag
I'd recommend avoiding using "*" in `apt` commands wherever possible
Score:2
cn flag

Review the list of the packages that were actually installed.

Find that list at /var/log/apt/history.log.

Remove only the packages on that list.

Hannu avatar
ca flag
`$ cat /var/log/apt/history.log` -> nothing. I assume that happens when you have rebooted.
user535733 avatar
cn flag
@Hannu not due to a reboot, but definitely when that log rotates on the 1st day of each month. A stock Ubuntu system will preserve last month's log also. It's in the same directory.
Hannu avatar
ca flag
`$ ls -l /var/log/apt/ | wc -l` -> `28` -- so yes, there was a bunch more.
Score:1
ca flag

sudo apt remove gnome-* will remove all packages that does match that,
also the ones that were install prior to your "mishap".

Now, what follows has not been tried, beware ;-)

  1. Do
    $ dpkg --list | grep -E "^ii[[:space:]]+gnome" | tr -s ' ' | cut -d' ' -f2 | sed -re "s/^/sudo apt uninstall /" > filename
    then remove the lines below from that file (to keep them)... [ created on my 20.04 ubuntu ]
  2. save the file, exit the editor
  3. do source filename from a terminal.
gnome-accessibility-themes
gnome-bluetooth
gnome-calculator
gnome-calendar
gnome-characters
gnome-clocks
gnome-control-center
gnome-control-center-data
gnome-control-center-faces
gnome-desktop3-data
gnome-disk-utility
gnome-font-viewer
gnome-getting-started-docs
gnome-initial-setup
gnome-keyring
gnome-keyring-pkcs11:amd64
gnome-logs
gnome-mahjongg
gnome-menus
gnome-mines
gnome-online-accounts
gnome-power-manager
gnome-screenshot
gnome-session-bin
gnome-session-canberra
gnome-session-common
gnome-settings-daemon
gnome-settings-daemon-common
gnome-shell
gnome-shell-common
gnome-shell-extension-appindicator
gnome-shell-extension-desktop-icons
gnome-shell-extension-prefs
gnome-shell-extension-ubuntu-dock
gnome-shell-extensions
gnome-startup-applications
gnome-sudoku
gnome-system-monitor
gnome-terminal
gnome-terminal-data
gnome-themes-extra:amd64
gnome-themes-extra-data
gnome-todo
gnome-todo-common
gnome-tweaks
gnome-user-docs
gnome-video-effects
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.