The alternatives command (man page) is a tool to create, remove, maintain and display information about the symbolic links comprising the alternatives system. So, you make system-wide changes with it and, thus, you need a user with elevated privileges. You either have to sudo update-alternatives (if sudo is installed and the user is a sudoer) or login as root with su - and then run said command. This answer to a question about how one runs commands that need root permissions may be helpful to you.

Answer from nikolas on Stack Exchange
🌐
Iconchronicle
iconchronicle.com › en › alternatives-command-not-found-centos
Repair And Fix Centos Alternative Command Not Found – Icon Chronicle
terms like Java, (x)emacs(-nox), (n )vi ( m ), whois and iptables are invariably among the first to receive certain alternatives for them. For truly generic terms such as EDITOR and/or CC, the alternatives command is not considered a suitable solution.
Discussions

Alternatives not working well for Java installation on Centos 6.4 - Unix & Linux Stack Exchange
I am trying to installing on Centos java from Oracle. Following are my steps. yum install /usr/local/jdk-7u3-linux-x64.rpm alternatives --install /usr/bin/java java /usr/java/latest/jre/bin/java ... More on unix.stackexchange.com
🌐 unix.stackexchange.com
May 27, 2013
c++ - How to use update-alternatives in centos? - Stack Overflow
As later versions of gcc are not available for download I've built gcc-10.2 myself. I'm now trying to update centos to use the new gcc/g++ programs instead of the old ones. On ubuntu the command to do this is · update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-10 More on stackoverflow.com
🌐 stackoverflow.com
java - /usr/bin/alternatives command throws usage error - Stack Overflow
I'm trying to upgrade my java installation on Oracle Linux 6.5. My VM came with jdk1.6 and I installed jdk1.7 (via rpm). But "java -version" still shows 1.6. As root, I tried /usr/bin/alternatives... More on stackoverflow.com
🌐 stackoverflow.com
java - sudo: update-alternatives: command not found - Stack Overflow
I am trying to install Java version 8 on my MacOS. The installation guideline advises typing this command: sudo update-alternatives --install /usr/bin/java java /usr/lib/java/JDk.../bin/java But it More on stackoverflow.com
🌐 stackoverflow.com
March 26, 2020
🌐
LinuxQuestions.org
linuxquestions.org › questions › mandriva-30 › alternatives-command-not-working-384654
alternatives command not working
November 19, 2005 - I am installing Java and following these instructions. When I use the alternatives command I get this response. [timb@Home timb] su - [root@Home root]
🌐
Command Not Found
command-not-found.com › update-alternatives
command-not-found.com – update-alternatives
Add a symbolic link: sudo update-alternatives --install path/to/symlink command_name path/to/command_binary priority
🌐
Loginroot
pkgs.loginroot.com › errors › notFound › update-alternatives
update-alternatives: command not found
[root@server ~]# echo $PATH /usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin If it's empty, You may set the PATH variable with this command · export PATH="/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin" /usr/sbin/update-alternatives - from package: chkconfig You may install the required package with command yum install {package}
🌐
Linux Mint Forums
forums.linuxmint.com › board index › main edition support › software & applications
SOLVED - linux command "update-alternatives" not available on 19.3 - Linux Mint Forums
December 28, 2019 - $ sudo update-alternatives --list python /usr/bin/python2.7 /usr/bin/python3.6 /usr/local/bin/python3.7 Marked SOLVED (maybe some system update was missing)
Find elsewhere
🌐
Stack Overflow
stackoverflow.com › questions › 25692159 › usr-bin-alternatives-command-throws-usage-error
java - /usr/bin/alternatives command throws usage error - Stack Overflow
1 root root 22 Jun 12 10:37 /usr/bin/java -> /etc/alternatives/java MY-MACHINE:/usr/java/jdk1.7.0_55/bin # ls -al /usr/java/jdk1.7.0_55/bin/java -rwxr-xr-x 1 root root 7718 Mar 17 22:05 /usr/java/jdk1.7.0_55/bin/java · Can anyone else see what I'm doing wrong? Cheers. ... That should be --install with two hyphens, not –install with an em-dash or -install with one hyphen.
🌐
Stack Overflow
stackoverflow.com › questions › 60863458 › sudo-update-alternatives-command-not-found
java - sudo: update-alternatives: command not found - Stack Overflow
March 26, 2020 - I am trying to install Java version 8 on my MacOS. The installation guideline advises typing this command: sudo update-alternatives --install /usr/bin/java java /usr/lib/java/JDk.../bin/java ... IIRC, update-alternatives is not a MacOS command, but a Linux command.
🌐
Baeldung
baeldung.com › home › administration › the update-alternatives command in linux
The update-alternatives Command in Linux | Baeldung on Linux
July 24, 2024 - Let’s notice that the priority is higher than the highest to date. So the new editor becomes the automatic mode choice. However, we can’t overwrite the manual selection in this way. With micro selected, let’s try to obtain the editor‘s manual: ... So we need to add a slave link to the micro‘s links group. First, let’s check the editor‘s links: $ sudo update-alternatives --display editor editor - auto mode link best version is /usr/bin/micro link currently points to /usr/bin/micro link editor is /usr/bin/editor slave editor.1.gz is /usr/share/man/man1/editor.1.gz # more output skipped
🌐
FedoraForum.org
forums.fedoraforum.org › showthread.php
'alternatives' command missing
I finally got java working after a day and a half, but i noticed amongst my hundreds of searches that a lot of people were using a command ('alternatives') to get it working. I tried the method, but whenever i use alternatives it says: bash: alternatives: command not found Why is that?
🌐
TecAdmin
tecadmin.net › linux-update-alternatives-command
Update-alternatives Command: A Comprehensive Guide for Linux Users – TecAdmin
April 26, 2025 - Solution: If you encounter an error stating that there are no alternatives for a command, it’s likely that the alternative has not been installed yet.