Use the update-alternatives command in Linux, updatealternatives
Personal blog address: http://www.cnblogs.com/wdfwolf3/
Update-alternatives is a command used by the ubuntu system to switch the software version. For example, if there are several jdk versions in the system, map the directories where these commands are located to a unified system directory as links, and then manage them through update-alternatives, set the default start version. You can use update-alternatives -- help to view the detailed usage of the command,
1. display options
View all links of a command. Detailed information is displayed, including the mode (manual or automatic) and the priority value of the link,
2. install option (-- install <link> <Name> <path> <priority> [-- slave <link> <Name> <path>])
Add a new command link. <link> is the public link directory of the command in the system, <Name> name of the command link, and <path> is the directory where the newly added command is located, <priority> is a value. When the mode is automatic, the system selects a value to start.
For example: update-alternatives -- install/usr/bin/java/usr/lib/java/jdk-1.8.0_92/bin/java 300. The installed JDK 8 is mapped from its installation location to the/usr/bin/java link of the system. When the java command is executed, the system selects one of the versions of all links for execution.
3. config options
Lists all the link options of this command, and you can select a default start link as prompted.
4. remove option (-- remove <Name> <path>)
The path is the directory of the link to be deleted by the command, not the public directory of the system. If you want to delete all the links of this command, the -- remove-all option is used, naturally, this option does not require a path because all paths are deleted.
5. auto Option
This is relatively simple, that is, to set a command to the automatic mode.