Adding Permanent alias using update-alternatives

sudo update-alternatives --install [target_path] [alternative_name] [source_path] [priority]
  • alternative_name -> name for managing alternative

  • target_path -> usuall /usr/bin/{alternative_name} (if you want to use same command as alternative_name)

  • source_path -> source path of binary you can use $(which COMMAND)

  • priority -> priority number for alternative (useful when multiple alternatives for one)

Example:

sudo update-alternatives --install /usr/bin/python python $(which python3) 10
  • /usr/bin/python -> target

  • python -> Alternative name

  • $(which python3) -> gives the source for python 3

  • 10 -> Priority