alternatives
Manage default commands between multiple versions
TLDR
View documentation for the original command
SYNOPSIS
alternatives --install <link> <name> <path> <priority> [--slave <slink> <sname> <spath> ...] | --remove <name> <path> | --display <name> | --config <name> | --auto <name> | ...
PARAMETERS
--install <link> <name> <path> <priority>
Install a new alternative symlink with given priority
--slave <slink> <sname> <spath>
Add slave symlink for multi-file alternatives (used with --install)
--remove <name> <path>
Remove specified alternative path from the system
--display <name>
Display current status and alternatives for a name
--query <name|path>
Query details about an alternative name or path
--list [<pattern>]
List all alternatives matching optional pattern
--config <name>
Interactively select default alternative for a name
--auto <name>
Auto-select highest priority alternative for a name
--set <name> <path>
Set specific path as default for a name
--verbose
Enable verbose output
--test
Test mode; do not modify system
--family <family>
Specify alternative family (with --install)
--user
User-specific alternatives (non-root)
DESCRIPTION
The alternatives command is a tool used primarily on Red Hat-based Linux distributions (like Fedora, CentOS, RHEL) to administer the alternatives system. This system allows multiple implementations of a single command or program to coexist on the system, with one designated as the default via symbolic links in standard directories like /usr/bin or /usr/sbin.
It enables administrators to switch between different versions or implementations of tools (e.g., vi, editor, python) without manual symlink management. Priorities determine the default choice, and commands like --config allow interactive selection.
Key benefits include easy handling of package conflicts during updates and multi-version support for development environments. It maintains a database in /var/lib/alternatives and /etc/alternatives, ensuring consistent master links. Unlike Debian's update-alternatives, it's tailored for RPM ecosystems but serves the same purpose.
CAVEATS
Requires root privileges for system-wide changes; incorrect use can break default commands. Not available on Debian/Ubuntu (use update-alternatives). Slave links must match exactly.
FILES
/usr/bin/alt-install, /var/lib/alternatives (database), /etc/alternatives (master symlinks)
EXAMPLES
alternatives --install /usr/bin/editor editor /usr/bin/vim.basic 10
alternatives --install /usr/bin/editor editor /usr/bin/nano 20
alternatives --config editor (interactive switch)
HISTORY
Introduced by Red Hat in the late 1990s as part of RPM packaging to resolve multi-provider conflicts. Evolved with Fedora/RHEL releases; stabilized in RHEL 4+. Mirrors Debian's update-alternatives from 1997 but optimized for RPM init scripts and spec files.
SEE ALSO
update-alternatives(8), ln(1), readlink(1)


