User Tools

Site Tools


linux:update-alternatives

Using update-alternatives has some advantages. Here a sample how to add for example IntelliJ.

Add the application '/opt/intellij/idea-IU-182.4892.20/bin/idea.sh' as idea to /usr/bin

sudo update-alternatives --install /usr/bin/idea idea /opt/intellij/idea-IU-182.4892.20/bin/idea.sh 1

If there are multiple version you can list it with:

sudo update-alternatives --display idea

idea - manual mode
  link best version is /opt/intellij/idea-IU-181.4445.78/bin/idea.sh
  link currently points to /opt/intellij/idea-IU-181.4445.78/bin/idea.sh
  link idea is /usr/bin/idea
/opt/intellij/idea-IU-181.4445.78/bin/idea.sh - priority 1
/opt/intellij/idea-IU-182.4892.20/bin/idea.sh - priority 1

And select with

sudo update-alternatives --config idea 
There are 2 choices for the alternative idea (providing /usr/bin/idea).

  Selection    Path                                           Priority   Status
------------------------------------------------------------
  0            /opt/intellij/idea-IU-181.4445.78/bin/idea.sh   1         auto mode
* 1            /opt/intellij/idea-IU-181.4445.78/bin/idea.sh   1         manual mode
  2            /opt/intellij/idea-IU-182.4892.20/bin/idea.sh   1         manual mode

Press <enter> to keep the current choice[*], or type selection number:
linux/update-alternatives.txt · Last modified: 2018/10/27 11:53 by els