The alternatives
command (package chkconfig
) on RHEL/Fedora manages symlinks which link a generic name to one of the alternative implementations. For example, mta
group of symlinks can be provided by Sendmail and Postfix (to implement i.e. sendmail
command):
alternatives --display mta
While I can --display
a group of symlinks, I need to guess its name first (i.e. mta
).
Can I simply list all possible configurable symlink groups (like mta
) to pick from?
The reason is that I forget some group names occasionally.
On Debian (but not Fedora or RHEL), to see a list of all "master alternative names":
And for each of those listed, you can run
--list $ALTERNATIVE_NAME
, e.g.If you would like to see a list of all alternatives in their respective groups, you could run the following in
fish
shell:The (ba|z)?sh syntax should be something similar.
To change the alternatives, run
sudo update-alternatives --config $ALTERNATIVE_NAME
The exact answer is (RHEL):
Directory
/etc/alternatives
maintains flat long list of all symlinks mixing masters and slaves together. Slave symlinks cannot be used withalternatives --display [symlink]
command.At the same time directory
/var/lib/alternatives
contains status information (including master-slave relationship) for each group in shortened list of file names all of which can be directly used with--display
option. For example,/var/lib/alternatives/java
:The simplest answer would be...
On Ubuntu 12.04 (may be some prior versions too, to be checked) and probably Debian too (to be checked):
List it just to get configurable alternative names, as entries in this directories are not links. By the way, there may be compressed file in this directory, so the names listed there, can't always be used as‑is. Ex. I have a
/var/lib/dpkg/alternatives/psql.1.gz