alternatives命令使用方法
alternatives命令使用方法
alternatives是Linux下的一個功能強大的命令。僅僅能在root權限下運行。如系統中有幾個命令功能十分相似,卻又不能任意刪除,那么能夠用 alternatives 來指定一個全局的設置。
alternatives經常使用于同一個系統中安裝同一軟件的多個版本號。比方為了開發須要,我須要安裝JDK1.4.2,同一時候還須要JDK1.6.10,我怎么樣才干忽略安裝路徑,依照我自己的意思,使用我想要的java版本號呢?
以下為您一一道來。
alternatives的命令行運行例如以下:
[root@localhost tools]# alternatives?
alternatives version 1.3.36 - Copyright (C) 2001 Red Hat, Inc.
This may be 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>
說明:
alternatives --install <link> <name> <path> <priority>
當中,
install表示安裝
link是符號鏈接
name則是標識符
path是運行文件的路徑
priority則表示優先級
以java的安裝為例,我的Fedora 8下自帶了兩種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
我在文件夾/tools/jdk安裝了java version "1.4.2_19"
[root@localhost test]# alternatives --install /usr/bin/java java /tools/jdk/bin/java 3
[root@localhost test]# alternatives --config java
There are 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
我還在文件夾/tools/jdk6下安裝了java version "1.6.0_12"
[root@localhost test]# alternatives --install /usr/bin/java java /tools/jdk6/bin/java 4
[root@localhost test]# alternatives --config java
There are 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
用alternatives --config java就能夠選擇你想要的Java版本號。
總結
以上是生活随笔為你收集整理的alternatives命令使用方法的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: Keras深度学习实战(31)——构建电
- 下一篇: 对象结构