Linux "update-alternatives" Command Line Options and Examples
maintain symbolic links determining default commands

update-alternatives creates, removes, maintains and displays information about the symbolic links comprising the Debian alternatives system. It is possible for several programs fulfilling the same or similar functions to be installed on a single system at the same time. For example, many systems have several text editors installed at once.


Usage:

update-alternatives [option...] command




Command Line Options:

--altdir
Specifies the alternatives directory, when this is to be different from the default.
update-alternatives --altdir ...
--admindir
Specifies the administrative directory, when this is to be different from the default.
update-alternatives --admindir ...
--log
Specifies the log file (since version 1.15.0), when this is to be different from the default(/var/log/alternatives.log).
update-alternatives --log ...
--force
Allow replacing or dropping any real file that is installed where an alternative link has to beinstalled or removed.
update-alternatives --force ...
--skip-auto
Skip configuration prompt for alternatives which are properly configured in automatic mode. This optionis only relevant with --config or --all.
update-alternatives --skip-auto ...
--verbose
Generate more comments about what is being done.
update-alternatives --verbose ...
--quiet
Don't generate any comments unless errors occur.EXIT STATUS0 The requested action was successfully performed.2 Problems were encountered whilst parsing the command line or performing the action.ENVIRONMENTDPKG_ADMINDIRIf set and the --admindir option has not been specified, it will be used as the base administrativedirectory.FILES/etc/alternatives/The default alternatives directory. Can be overridden by the --altdir option./var/lib/dpkg/alternatives/The default administration directory. Can be overridden by the --admindir option.QUERY FORMATThe --query format is using an RFC822-like flat format. It's made of n + 1 blocks where n is the number ofalternatives available in the queried link group. The first block contains the following fields:Name: nameThe alternative name in the alternative directory.Link: linkThe generic name of the alternative.Slaves: list-of-slavesWhen this field is present, the next lines hold all slave links associated to the master link of thealternative. There is one slave per line. Each line contains one space, the generic name of the slavealternative, another space, and the path to the slave link.Status: statusThe status of the alternative (auto or manual).Best: best-choiceThe path of the best alternative for this link group. Not present if there is no alternativesavailable.Value: currently-selected-alternativeThe path of the currently selected alternative. It can also take the magic value none. It is used ifthe link doesn't exist.The other blocks describe the available alternatives in the queried link group:Alternative: path-of-this-alternativePath to this block's alternative.Priority: priority-valueValue of the priority of this alternative.Slaves: list-of-slavesWhen this field is present, the next lines hold all slave alternatives associated to the master link ofthe alternative. There is one slave per line. Each line contains one space, the generic name of theslave alternative, another space, and the path to the slave alternative.Example$ update-alternatives --query editorName: editorLink: /usr/bin/editorSlaves:editor.1.gz /usr/share/man/man1/editor.1.gzeditor.fr.1.gz /usr/share/man/fr/man1/editor.1.gzeditor.it.1.gz /usr/share/man/it/man1/editor.1.gzeditor.pl.1.gz /usr/share/man/pl/man1/editor.1.gzeditor.ru.1.gz /usr/share/man/ru/man1/editor.1.gzStatus: autoBest: /usr/bin/vim.basicValue: /usr/bin/vim.basicAlternative: /bin/edPriority: -100Slaves:editor.1.gz /usr/share/man/man1/ed.1.gzAlternative: /usr/bin/vim.basicPriority: 50Slaves:editor.1.gz /usr/share/man/man1/vim.1.gzeditor.fr.1.gz /usr/share/man/fr/man1/vim.1.gzeditor.it.1.gz /usr/share/man/it/man1/vim.1.gzeditor.pl.1.gz /usr/share/man/pl/man1/vim.1.gzeditor.ru.1.gz /usr/share/man/ru/man1/vim.1.gzDIAGNOSTICSWith --verbose update-alternatives chatters incessantly about its activities on its standard output channel.If problems occur, update-alternatives outputs error messages on its standard error channel and returns anexit status of 2. These diagnostics should be self-explanatory; if you do not find them so, please reportthis as a bug.EXAMPLESThere are several packages which provide a text editor compatible with vi, for example nvi and vim. Which oneis used is controlled by the link group vi, which includes links for the program itself and the associatedmanpage.To display the available packages which provide vi and the current setting for it, use the --display action:update-alternatives --display viTo choose a particular vi implementation, use this command as root and then select a number from the list:update-alternatives --config viTo go back to having the vi implementation chosen automatically, do this as root:update-alternatives --auto vi
update-alternatives --quiet ...