I. Functional role
Update-alternatives is a utility for dpkg that maintains symbolic links to system commands to determine what commands the system uses by default.
In the Debian system, we may install a number of similar programs and optional configurations, such as Web browser programs (firefox,konqueror), window managers (Wmaker, metacity), and different themes for the mouse. In this way, users can choose when they are using the system to meet their own needs.
For ordinary users, however, it is more difficult to choose between these programs. The Update-alternatives tool is designed to solve this problem and help users to easily select their own favorite programs and configure system functions.
The most obvious scenarios, such as installing OPENJDK and JDK at the same time, can be toggled using Java on the command line.
Second, location
/usr/bin/update-alternatives
Third, format usage
Update-alternatives [< Options > ...] < commands >
Four, the main parameters
Commands:--install<link> <name> <Path> < Priority>[--slave<link> <name> <Path] ...Adding a set of replacements to the system.--remove<name> <Path> Remove < path > items from < name > substitution group.--remove-all<name> Remove < name > substitution group from the replacement system.--auto<name> Switch the < name > main link to auto mode.--display<name> displays information about the < name > substitution group.--query<name> Machine parseable version of--display <name>.--list<name> Lists < names > all available replacements in the substitution group.--get-selections List Master alternative names and their status. --Set-selections read alternative status from standard input.--config<name> List < name >Replace the options in the group and consult with the user about which one to use. --Set<name> <Path> Set < path > to the replacement of < name >.--all Call--config command for all optional one by one.<link> is a symbolic link to/etc/alternatives/< name >;. (e.g./usr/bin/pager) <name> is the main control name of the chain that replaced the group. (e.g. pager) <Path> is the location of the replacement target file. (e.g./usr/bin/less) < Priority> is an integer, in automatic mode, the higher the number of options, the higher the priority.Options:--altdir<directory> specify a different optional directory.--admindir<directory> specify a different management directory.--log<file> set up the log file.--force allow replacingFileswith alternative links.--skip-auto Skipprompt foralternatives correctly configured in automaticMode(Relevant for--config only)--verbose detailed operation for information, more output.--quiet Quiet mode, output as little information as possible.--HELP Display this help information.--version displaying version information.
V. Examples of applications
1. List the available candidate commands
Update-alternatives--list Java
2, display and modify the actual direction of the candidate commands,
sudo update-alternatives--config java
3. Configure all the candidate commands on the system
sudo update-alternatives--all
4. Display all optional commands for a command link
Update-alternatives--display Editor
5. Switch the < name > main link to Auto mode
sudo update-alternatives--auto Editor
6. Add a set of replacements to the system
sudo update-alternatives--install x-cursor-theme x-cursor-theme/etc/x11/cursors/gold.theme 70
Reference:
http://www.lampblog.net/ubuntu/update-alternatives%E5%91%BD%E4%BB%A4/(the above content is transferred from this article)
http://jingyan.baidu.com/article/ff42efa92a64c9c19e2202d2.html (Configuring the Switch for Java)
Http://coolnull.com/3339.html
Http://www.jb51.net/article/112372.htm
Http://www.cnblogs.com/caidi/p/6009217.html
Http://www.mamicode.com/info-detail-1144825.html
http://blog.csdn.net/zm_21/article/details/9495249
Dpkg tool update-alternatives in linux to switch between symbolic link software versions (RPM)