Is there a way to list all configurable `alternatives` (symlinks for similar commands) on the system?
Solution 1:
On Debian (but not Fedora or RHEL), to see a list of all "master alternative names":
update-alternatives --get-selections
--get-selections
list master alternative names and their status.
And for each of those listed, you can run --list $ALTERNATIVE_NAME
, e.g.
update-alternatives --list editor
--list name
Display all targets of the link group.
If you would like to see a list of all alternatives in their respective groups, you could run the following in fish
shell:
for alternative in (update-alternatives --get-selections)
echo $alternative
update-alternatives --list (echo $alternative | cut -d" " -f1)
echo
end | pager
The (ba|z)?sh syntax should be something similar.
To change the alternatives, run sudo update-alternatives --config $ALTERNATIVE_NAME
Solution 2:
The exact answer is (RHEL):
ls /var/lib/alternatives
Directory /etc/alternatives
maintains flat long list of all symlinks mixing masters and slaves together. Slave symlinks cannot be used with alternatives --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
:
alternatives --display java
Solution 3:
The simplest answer would be...
ls /etc/alternatives