Forrest logo
back to the update-alternatives tool

update-alternatives:tldr:06ca3

update-alternatives: Add a symbolic link.
$ sudo update-alternatives --install ${path-to-symlink} ${command_name} ${path-to-command_binary} ${priority}
try on your machine

The command sudo update-alternatives --install ${path-to-symlink} ${command_name} ${path-to-command_binary} ${priority} is used in Linux to create or update a symbolic link (alternative) for a specific command.

Here is a breakdown of the command:

  • sudo is used to execute the following command with administrative privileges.
  • update-alternatives is the command that manages the symbolic links for different commands.
  • ${path-to-symlink} represents the path where the symbolic link (alternative) should be created. This is typically a location in the system's binary directory like /usr/bin.
  • ${command_name} specifies the name of the command that you want to link or update.
  • ${path-to-command_binary} is the path to the binary file of the command that you want the symbolic link to point to.
  • ${priority} is an integer value that determines the priority of the alternative. If multiple alternatives exist for the same command, the one with the highest priority will be used as the default.

Essentially, this command allows you to set an alternative binary for a given command. By doing so, you can easily switch between different versions or implementations of the same command without changing the actual command name.

This explanation was created by an AI. In most cases those are correct. But please always be careful and never run a command you are not sure if it is safe.
back to the update-alternatives tool