update-alternative

Good Day Guys,

just want to as about the following code

sudo update-alternatives -h

result

sudo: update-alternatives: command not found

can you help me about this, I want to use this command
want to try Oracle JDK and this command is needed based on the instruction

https://sites.google.com/site/easylinuxtipsproject/java-for-opensuse

Thanks in advance guys

Long Live Linux and OpenSUSE

Use


sudo /usr/sbin/update-alternatives -h

if you want to use sudo.


PC: oS 11.4 (dual boot 12.1) 64 bit | Intel Core i7-2600@3.40GHz | KDE
4.6.0 | GeForce GT 420 | 16GB Ram
Eee PC 1201n: oS 11.4 64 bit | Intel Atom 330@1.60GHz | KDE 4.8.0 |
nVidia ION | 3GB Ram

Sorry i missed something, the command has no -h switch, what are you
trying to do?


PC: oS 11.4 (dual boot 12.1) 64 bit | Intel Core i7-2600@3.40GHz | KDE
4.6.0 | GeForce GT 420 | 16GB Ram
Eee PC 1201n: oS 11.4 64 bit | Intel Atom 330@1.60GHz | KDE 4.8.0 |
nVidia ION | 3GB Ram

I included -h to know more about it
like a help

Long Live Linux and OpenSUSE

Also, in windows there is what is called a “PATH” environment variable, you add the location of the app you want so that it can be ran on the command prompt
is this possible on linux?
if yes, how do I set this up? ex. this update-alternative, add this to the path variable to be ran directly to the command prompt

Thanks in advance Sir

Long Live Linux and OpenSUSE!!!

On 2012-02-10 21:16, Jomar808 wrote:
>
> Also, in windows there is what is called a “PATH” environment variable,
> you add the location of the app you want so that it can be ran on the
> command prompt
> is this possible on linux?

Of course.

> if yes, how do I set this up? ex. this update-alternative, add this to
> the path variable to be ran directly to the command prompt

The path is correctly set, don’t change it.

Simply, when you use sudo you are not yet root, so you have the path as
correct for a plain user, not for root.

If you get yourself root first, it works:


su -


Cheers / Saludos,

Carlos E. R.
(from 11.4 x86_64 “Celadon” at Telcontar)

There are several things here which you need to see.

  1. there is absolutely no point in running an application as root just
    to get help

/usr/sbin/update-alternatives --help #as normal user
man update-alternatives #as normal user for more help

  1. of course you can adjust your PATH

export PATH=/usr/sbin:$PATH

put it for example into your ~/.profile
you still need root rights for most of the functionality.

  1. make yourself familiar with the basics of linux, for example
    http://rute.2038bug.com/index.html.gz
    http://en.opensuse.org/SDB:Official_documentation
    and many more


PC: oS 11.4 (dual boot 12.1) 64 bit | Intel Core i7-2600@3.40GHz | KDE
4.6.0 | GeForce GT 420 | 16GB Ram
Eee PC 1201n: oS 11.4 64 bit | Intel Atom 330@1.60GHz | KDE 4.8.0 |
nVidia ION | 3GB Ram

On 02/10/2012 07:26 PM, Jomar808 wrote:
> sudo update-alternatives -h

NO! that page on google NOWHERE says to use “sudo update-alternatives”
nor does it say you can get help by using “sudo update-alternatives -h”

you must be precise!

evidently you have been exposed to Ubuntu which is NOT openSUSE… in
Ubuntu they never use root and always use sudo…don’t do that here…

the command “update-alternatives” is given by root as


su -
update-alternatives
exit

if you wish to add the help flag, do it the same way…but, MUCH more
info on update-alternatives is available from its manual or help, thus:


su -
man update-alternatives
info update-alternatives

actually, i’m not sure if one must be root to read the man and info for
a root only command…i can read them on my machine as a normal user, so
try it that way first


DD http://tinyurl.com/DD-Caveat
Read what Distro Watch writes: http://tinyurl.com/SUSEonDW

On 2012-02-11 16:40, DenverD wrote:
> actually, i’m not sure if one must be root to read the man and info for a
> root only command…i can read them on my machine as a normal user, so try
> it that way first

Information can be restricted, but to what point? You can have some manual
pages readable only by root, but you can install the same system at home
and read them, or even on internet. It is useless to restrict access to man
pages.


Cheers / Saludos,

Carlos E. R.
(from 11.4 x86_64 “Celadon” at Telcontar)

You don’t need to be root to read the MAN pages (and specifically update-alternatives).
Also, newbies should know that the convention in openSUSE is to use double-hyphens, eg


$ update-alternatives --help

BTW - Here is a mini-FAQ based on my personal use of update-alternatives…

It’s very rare when someone should need to setup an update-alternatives entry, more typically anytime a new option is installed properly into openSUSE, update-alternatives will be setup automatically for the User to switch between options.

So, for me the most common use is to switch between various Java. Today, there is still some software that requires Sun Java SE 1.5, openJDK 1.6 is installed by default, and for various reasons you may need to have both JDK as well as JRE packages available on a system.

Because JAVA is one of the groups supported by update-alternatives, all you need to do is install the packages from both Sun/Oracle and the openSUSE repos you wish, and with the following command you can switch between any of them


$ update-alternatives --config java

Cool, huh?

The other command you might find useful is to list the various groups supported by update-alternatives


$ update-alternatives --get-selections

HTH,
TS