Linux Alternatives Command detailed

Source: Internet
Author: User

Alternatives is a powerful command under Linux. Can only be performed under root authority. If there are several command functions in the system that are very similar, but can not be arbitrarily deleted, then use alternatives to specify a global setting.

Alternatives is commonly used to install multiple versions of the same software on the same system. For example, in order to develop the need, I need to install JDK1.4.2, but also need to JDK1.6.10, how can I ignore the installation path, according to my own meaning, using the Java version I want it?

Here are one by one of your paths.

The alternatives command line executes as follows:
[Email protected] tools]# alternatives
Alternatives version 1.3.36-copyright (C) 2001 Red Hat, Inc.
This is freely redistributed under the terms of the GNU public License.

Usage:alternatives--install <link> <name> <path> <priority>
[--initscript <service>]
[--slave <link> <name> <path>]*
Alternatives--remove <name> <path>
Alternatives--auto <name>
Alternatives--config <name>
Alternatives--display <name>
Alternatives--set <name> <path>

Common options:--verbose--test--help--usage--version
--altdir <directory>--admindir <directory>

Description
Alternatives--install <link> <name> <path> <priority>
which
Install indicates installation
Link is a symbolic link
Name is the identifier
Path is the way to execute the file
Priority indicates precedence

As an example of Java installation, my Fedora 8 comes with two versions of Java, respectively, as follows:

Selection Command
-----------------------------------------------
* 1/usr/lib/jvm/jre-1.7.0-icedtea/bin/java
2/usr/lib/jvm/jre-1.5.0-gcj/bin/java


I have Java version "1.4.2_19" installed in directory/TOOLS/JDK
[Email protected] test]# Alternatives--install/usr/bin/java Java/tools/jdk/bin/java 3
[Email protected] test]# Alternatives--config java

There is 3 programs which provide ' Java '.

Selection Command
-----------------------------------------------
*+ 1/usr/lib/jvm/jre-1.7.0-icedtea/bin/java
2/usr/lib/jvm/jre-1.5.0-gcj/bin/java
3/tools/jdk/bin/java

Enter to keep the current selection[+], or type selection Number:3


I also installed the Java version "1.6.0_12" under Directory/tools/jdk6
[Email protected] test]# Alternatives--install/usr/bin/java Java/tools/jdk6/bin/java 4
[Email protected] test]# Alternatives--config java

There is 4 programs which provide ' Java '.

Selection Command
-----------------------------------------------
* 1/usr/lib/jvm/jre-1.7.0-icedtea/bin/java
2/usr/lib/jvm/jre-1.5.0-gcj/bin/java
+ 3/tools/jdk/bin/java
4/tools/jdk6/bin/java

Enter to keep the current selection[+], or type selection number:4

You can choose the Java version you want with alternatives--config java.

Linux Alternatives Command detailed

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.