Differences between revisions 1 and 8 (spanning 7 versions)
Revision 1 as of 2007-07-11 02:16:34
Size: 2506
Editor: BobProulx
Comment: Initial page
Revision 8 as of 2018-02-27 13:23:24
Size: 3043
Editor: ccts
Comment: this page mixes various intents and probably needs to get tidied
Deletions are marked like this. Additions are marked like this.
Line 1: Line 1:
#language en
~-[[DebianWiki/EditorGuide#translation|Translation(s)]]: English - [[it/DebianAlternatives|Italiano]] - [[ru/DebianAlternatives|Русский]]-~
----

''If you are looking for all other mechanisms to set default applications, refer to [[DesktopDefaultSettings|this page]].''

----
Line 3: Line 10:
The Debian alternatives system creates a process for several programs to that fullfill the same or similar functions to be listed as alternative implementations that are installed simultaneously but with one particular implementation designated as the default. For example many systems have several text editors installed at the same time. The {{{vi}}} program is a classic example of an editor that has many implementations such as {{{nvi}}}, {{{elvis}}}, {{{vim}}}, etc. but which one should be designated the default? The Debian alternatives system creates a way for several programs that fulfill the same or similar functions to be listed as alternative implementations that are installed simultaneously but with one particular implementation designated as the default. For example many systems have several text editors installed at the same time. The {{{vi}}} program is a classic example of an editor that has many implementations such as {{{nvi}}}, {{{elvis}}}, {{{vim}}}, etc. but which one should be designated as the default?
Line 5: Line 12:
Debian's alternatives system aims to solve the problem of selecting a default best version. Management is done through the {{{update-alternatives}}} program that creates, removes, maintains and displays information about the symbolic links comprising the Debian alternatives system. Priorities are assigned by the package creator.  The alternative with the highest priority selects the default value when in automatic mode. Additionally the local administrator may override the automatic selection with a manual selection. Debian's alternatives system aims to solve the problem of selecting a default preferred version. Management is done through the {{{update-alternatives}}} program that creates, removes, maintains and displays information about the symbolic links constituting the Debian alternatives system. Priorities are assigned by package creators. The alternative with the highest priority determines the default value when in automatic mode. Additionally the local administrator may override the automatic selection with a manual selection.
Line 7: Line 14:
The Debian alternatives system was originally created for Debian but has been picked up by other GNU/Linux software distributions. For example Red Hat now uses a fork of the code to maintain system software such as /usr/sbin/sendmail. On RHEL/Fedora the /usr/sbin/sendmail is an alternatives symlink to either the classic Sendmail or to Postfix as alternative implementations of an MTA. In fact the alternative group is called the {{{mta}}} group there. The Debian alternatives system was originally created for Debian but has been picked up by other GNU/Linux software distributions. For example Red Hat now uses a fork of the code to maintain system software such as {{{/usr/sbin/sendmail}}}. On RHEL/Fedora {{{/usr/sbin/sendmail}}} is an alternatives symlink to either the classic Sendmail or to Postfix as alternative implementations of an MTA. In fact the alternative group is called the {{{mta}}} group there.
Line 9: Line 16:
Here is a previous rant on the subject in the debian-user mailing list that I think is a good introduction to using the Debian alternatives system. I will eventually pull most of that discussion into this wiki page but for now will just reference it. Here is a previous rant on the subject in the debian-user mailing list that I think is a good introduction to using the Debian alternatives system. I will eventually pull most of that discussion into this wiki page but for now I will just reference it.
Line 16: Line 23:
Line 18: Line 24:
for i in $(ls /etc/alternatives); do
  update-alternatives --display $i;
done | awk '/status.is.manual/{print$1}'
for i in /etc/alternatives/*; do
  LANG=C update-alternatives --display "${i#/etc/alternatives/}"
done 2>/dev/null | awk '/manual.mode/{print $1}'
Line 23: Line 29:
If those all are something that you want to reset to automatic then If all of those are something that you want to reset to automatic then
Line 28: Line 34:
for i in $(ls /etc/alternatives); do
  update-alternatives --display $i;
done | awk '/status.is.manual/{print$1}' |
  xargs -l sudo update-alternatives --auto
for i in /etc/alternatives/*; do
  LANG=C update-alternatives --display "${i#/etc/alternatives/}"
done 2>/dev/null |
 
awk '/manual.mode/{print $1}' |
  xargs -L 1 sudo update-alternatives --auto
Line 33: Line 40:

== See Also ==
 * DebianPkg:galternatives - graphical setup tool for the alternatives system
 * http://www.debian-administration.org/articles/91

Translation(s): English - Italiano - Русский


If you are looking for all other mechanisms to set default applications, refer to this page.


Debian Alternatives System

The Debian alternatives system creates a way for several programs that fulfill the same or similar functions to be listed as alternative implementations that are installed simultaneously but with one particular implementation designated as the default. For example many systems have several text editors installed at the same time. The vi program is a classic example of an editor that has many implementations such as nvi, elvis, vim, etc. but which one should be designated as the default?

Debian's alternatives system aims to solve the problem of selecting a default preferred version. Management is done through the update-alternatives program that creates, removes, maintains and displays information about the symbolic links constituting the Debian alternatives system. Priorities are assigned by package creators. The alternative with the highest priority determines the default value when in automatic mode. Additionally the local administrator may override the automatic selection with a manual selection.

The Debian alternatives system was originally created for Debian but has been picked up by other GNU/Linux software distributions. For example Red Hat now uses a fork of the code to maintain system software such as /usr/sbin/sendmail. On RHEL/Fedora /usr/sbin/sendmail is an alternatives symlink to either the classic Sendmail or to Postfix as alternative implementations of an MTA. In fact the alternative group is called the mta group there.

Here is a previous rant on the subject in the debian-user mailing list that I think is a good introduction to using the Debian alternatives system. I will eventually pull most of that discussion into this wiki page but for now I will just reference it.

One-Liners to manipulate alternatives

Here is a long one-liner that will print out all manually configured Debian Alternatives symlinks.

for i in /etc/alternatives/*; do 
  LANG=C update-alternatives --display "${i#/etc/alternatives/}"
done 2>/dev/null | awk '/manual.mode/{print $1}'

If all of those are something that you want to reset to automatic then this can be done using the same generated list. Otherwise simply grep out the ones that you want or don't want.

for i in /etc/alternatives/*; do
  LANG=C update-alternatives --display "${i#/etc/alternatives/}"
done 2>/dev/null |
  awk '/manual.mode/{print $1}' | 
  xargs -L 1 sudo update-alternatives --auto

See Also