4

I was trying to get a Windows program to run on PlayOnLinux and after it didn't work I went to remove Wine with this command: sudo apt-get remove --purge wine*

and without thinking I agreed to remove every package on the machine. Can someone tell me why it selected every package instead of all the ones starting with the string "wine"?

I'm running Linux Mint 16

anlar
  • 4,165
ken
  • 41
  • What do you mean by "selected every package"? Did it remove all the packages installed? – Ramesh Jun 03 '14 at 18:00
  • it seemed like there was only the core OS left. all i got was a terminal after rebooting – ken Jun 03 '14 at 18:28
  • Are you sure you didn't type sudo apt-get remove --purge wine * accidentally putting a space between wine and *? Because that would do it. – Alex McKenzie Jun 03 '14 at 20:16
  • @AlexMcKenzie apt-get remove wine * would remove all packages whose name is a file in the current directory. In an empty directory, it would error out. – Gilles 'SO- stop being evil' Jun 03 '14 at 23:25
  • @Gilles you are making a fair few assumptions about the shell there. – Will Boyce Jun 03 '14 at 23:52
  • 1
    @WillBoyce I am assuming only that the shell is Bourne-style, csh-style or fish. This is a pretty safe assumption. Except for the part about an empty directory, where apt-get remove wine * is equivalent to apt-get remove wine in a few cases (bash or zsh with the nullglob option). – Gilles 'SO- stop being evil' Jun 03 '14 at 23:58

1 Answers1

5

If there is at least one file in the current directory whose name begins with wine, then wine* in the command expands to the list of files whose name begin with wine. If there is no such file, then

sudo apt-get remove --purge wine*

is executed. Arguments to apt-get install and apt-get remove are extended regular expressions, not shell wildcards; wine* means win followed by any number of e, and since this can match any part of the package name, this means any package whose name contains win as a substring. Plus, of course, any package that depends on these packages.

If you were using KDE, then you lost the kde-window-manager package. If not, you must have lost some other critical package. Maybe libmate-window-settings1 which is required by mate-control-center which is required by mate-desktop-environment-core whose loss would render most of the MATE packages superfluous. I checked Debian wheezy package names, Mint might have a different set, but you get the idea.

To remove just the packages whose names start with wine, use

sudo apt-get purge '^wine'

Check the list of packages carefully before confirming.

You may be more comfortable with Aptitude, which has a text mode full screen frontend.