bantana 30 March 2020
update-alternative --install [alias] [name] [file] [priority]
example:
$ sudo update-alternative --install /usr/bin/gcc gcc /usr/bin/gcc-10 20
check:
$ gcc --version
gcc (Ubuntu 10-20200324-1ubuntu1) 10.0.1 20200324 (experimental) [master revision 596c90d3559:023579257f5:906b3eb9df6c577d3f6e9c3ea5c9d7e4d1e90536] Copyright (C) 2020 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
$ sudo update-alternative --config cc There are 2 choices for the alternative cc (providing /usr/bin/cc). Selection Path Priority Status ------------------------------------------------------------ 0 /usr/bin/gcc 20 auto mode * 1 /usr/bin/clang 10 manual mode 2 /usr/bin/gcc 20 manual mode Press <enter> to keep the current choice[*], or type selection number: $ sudo update-alternative --config c++ There are 2 choices for the alternative c++ (providing /usr/bin/c++). Selection Path Priority Status ------------------------------------------------------------ 0 /usr/bin/g++ 20 auto mode * 1 /usr/bin/clang++ 10 manual mode 2 /usr/bin/g++ 20 manual mode Press <enter> to keep the current choice[*], or type selection number: