To remove VirtualBox, I actually recommend running this command and not replacing
* with anything (just run it exactly like so):
sudo apt-get remove virtualbox-\*
If you want to remove global configuration files too (this does not remove your virtual machines), run exactly this instead:
sudo apt-get purge virtualbox-\*
That method is OK, but this way may be more thorough.
You may have multiple VirtualBox-related packages installed. Assuming your machine no longer needs to be a VirtualBox host or guest machine, all these packages can go. For example, on the 11.10 box I'm using right now, there are 18 such packages available for installation (your machine might have some or even all of them, or other packages from your release or a PPA):
Some are probably already not installed, and some may be removed automatically as a consequence of removing others, but some would not.
apt-get accepts wildcards. So you don't have to manually expand
*. It can stay, and it will catch the various related packages as described above, as well as packages with explicit versions in their names as discussed there.
However, the shell itself, which executes
apt-get with the command-line arguments you specify, also accepts wildcards. Therefore, you should escape the wildcard (and one way to do that is with a
\ character before the
*). Otherwise, if your expression matches a file or folder in that current location, the shell would give its name to
apt-get, which would be wrong.
What does purge do here?
purge removes global configuration files only. It does not remove virtual machines, so it's safe to use. However:
- It also doesn't remove most of the settings you might think it would. Remember, it removes global configuration files only. It does not remove any configuration files created by users that exist in their home directories and define how VirtualBox is configured for them.
- Configuration files rarely take up a lot of space. If your goal is to free space but you think you may want to use VirtualBox again, you might prefer not to use
Also, please note:
apt-get --purge remove ... is the same as
apt-get purge ....