There are several cases where two packages provide two different versions of a program, both of which provide the same core functionality. Users might prefer one over another out of habit, or because the user interface of one package is somehow more pleasing than the interface of another. Other users on the same system might make a different choice.
For example, there might exist two different versions of newsreaders on a system. Which program is invoked is determined by a link pointing from a file with the virtual package name /etc/alternatives/vim to the selected file, e.g., /usr/bin/vim.gtk.
The Debian system has mechanism to install somewhat overlapping programs peacefully using update-alternatives(8). The Perl script update-alternatives provides a way of ensuring that all the files associated with a specified package are selected as a system default.
For example, you can make the vi command select to run vim while installing both vim and nvi packages.
The Debian alternatives system keeps its selection as symlinks in “/etc/alternatives/“. The selection process uses corresponding file in “/var/lib/dpkg/alternatives/“. The “/etc/alternatives” defines default applications for the Debian system – such as, the default application to handle editor, to browse the web etc.
For example, to check what executables provide `vim’, run:
$ sudo update-alternatives --display vim vim - status is auto. link currently points to /usr/bin/vim.gtk /usr/bin/vim.tiny - priority 10 /usr/bin/vim.basic - priority 30 /usr/bin/vim.gtk - priority 50 Current `best' version is /usr/bin/vim.gtk.
or use the ls command
$ ls -l $(type -p vim) lrwxrwxrwx 1 root root 21 2008-09-27 13:10 /usr/bin/vim -> /etc/alternatives/vim $ ls -l /etc/alternatives/vim lrwxrwxrwx 1 root root 16 2010-01-23 14:06 /etc/alternatives/vim -> /usr/bin/vim.gtk
If you want to change it, run:
$ sudo update-alternatives --config vim There are 3 alternatives which provide `vim'. Selection Alternative ----------------------------------------------- 1 /usr/bin/vim.tiny 2 /usr/bin/vim.basic *+ 3 /usr/bin/vim.gtk Press enter to keep the default[*], or type selection number:
And follow the instructions on the screen (basically, press the number next to the entry you’d like better).
To change the default web browser run:
$ sudo update-alternatives --config x-www-browser There are 3 alternatives which provide `x-www-browser'. Selection Alternative ----------------------------------------------- * 1 /usr/bin/iceweasel + 2 /usr/bin/epiphany-gecko 3 /usr/bin/google-chrome Press enter to keep the default[*], or type selection number:
To change the default editor run:
$ sudo update-alternatives --config editor
There is also a GTK program for doing this named galternatives.
$ sudo apt-get install galternatives