大网数据广告活动
服务器运维问答

Is there a way to list all configurable `alternatives` (symlinks for similar commands) on the system?

· 52CE 我爱测

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 imp…

问题原文

原帖链接 · uvsmtid · CC BY-SA 3.0

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.

社区高分解答

原帖链接 · kzh · CC BY-SA 4.0

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

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2013-03-05)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 3.0 / CC BY-SA 4.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。