Using the update-alternatives command of linux to maintain the system command link
This article will explain in detail about the use of linux's update-alternatives command to maintain the system command linker. The editor thinks it is very practical, so I share it with you for reference. I hope you can get something after reading this article.
Update-alternatives is a tool dedicated to maintaining system command linkers in Debian systems. Through it, you can easily set which command and which software version the system uses by default. For example, two versions of open jdk and sun jdk are installed in the system, and we want the system to use sun jdk by default, which can be easily managed through update-alternatives.
Syntax format: update-alternatives [parameters] [command]
Common parameters:
Reference example:
Set your own installed JDK to the default JDK version:
[root@linuxcool ~] # update-alternatives-- install / usr/bin/java java/ usr/lib/jvm/java/bin/java 1070 [root@linuxcool ~] # update-alternatives-- install / usr/bin/javac javac / usr/lib/jvm/java/bin/javac 1070 [root@linuxcool ~] # update-alternatives-- install / usr/bin/jar jar / usr/lib/jvm/java/bin/jar 1070 [root@linuxcool ~] # update-alternatives-install / usr/bin/javah javah / Usr/lib/jvm/java/bin/javah 1070 [root@linuxcool ~] # update-alternatives-- install / usr/bin/javap javap / usr/lib/jvm/java/bin/javap 1070
Select the version of JDK we installed:
[root@linuxcool] # update-alternatives-- config java
Select the version of JDK we installed:
[root@linuxcool] # update-alternatives-- config java
List the names of the main candidates and their status:
[root@linuxcool ~] # update-alternatives-- get-selections on using linux's update-alternatives command to maintain the system command linker is shared here. I hope the above content can be helpful to you and learn more knowledge. If you think the article is good, you can share it for more people to see.