2

Is it possible to substitute binary with same name alternative? I have /usr/bin/qtcreator

I want to use alternative version but /usr/bin/qtcreator is binary but not alternative.

What the way I should do this?

vsminkov
  • 10,912
  • 2
  • 38
  • 50
Juriy
  • 63
  • 1
  • 7
  • 3
    Change order of directories in $PATH variable, so that directory containing alternative appears before /usr/bin – mouviciel Sep 07 '16 at 10:56

2 Answers2

3

You could place your new qtcreator at /usr/local/bin/qtcreator, that location should have preference over /usr/bin.

You can check the possible locations for binaries and the order is which they are searched with echo $PATH and you can check which binary will be called with which qtcreator

Pelle
  • 1,222
  • 13
  • 18
2

In Bash:

$ alias qtcreator="/usr/local/bin/qtcreator"

or make sure the path to desired binary is mentioned before the undesired path in $PATH (... as mentioned by others).

James Brown
  • 36,089
  • 7
  • 43
  • 59
  • Note that `alias`es are only available in interactive shells. Else, use bash functions. – anishsane Sep 07 '16 at 11:51
  • anishsane, thx, what is interactive shell ? Is it special term for kind of a shell or your own term? And I remembered, I did likely you say, but then it's not able to run aliased qtcreator from bash script. – Juriy Sep 08 '16 at 10:53
  • That means `alternatives` could not do this work? – Nick Dong May 05 '19 at 04:07