Linux 命令 alternatives和update-alternatives 转贴

1. alternatives

 

Linux代码   收藏代码
  1. alternatives version  1.3 . 13.5 .EL4 - Copyright (C)  2001  Red Hat, Inc.  
  2. This may be freely redistributed under the terms of the GNU Public License.  
  3.   
  4. usage: alternatives --install <link> <name> <path> <priority>  
  5.                     [--initscript <service>]  
  6.                     [--slave <link> <name> <path>]*  
  7.        alternatives --remove <name> <path>  
  8.        alternatives --auto <name>  
  9.        alternatives --config <name>  
  10.        alternatives --display <name>  
  11.        alternatives --set <name> <path>  
  12.   
  13. common options: --verbose --test --help --usage --version  
  14.                 --altdir <directory> --admindir <directory>  
 

 

2. update-alternatives

 

Linux代码   收藏代码
  1. alternatives version  1.3 . 13.5 .EL4 - Copyright (C)  2001  Red Hat, Inc.  
  2. This may be freely redistributed under the terms of the GNU Public License.  
  3.   
  4. usage: alternatives --install <link> <name> <path> <priority>  
  5.                     [--initscript <service>]  
  6.                     [--slave <link> <name> <path>]*  
  7.        alternatives --remove <name> <path>  
  8.        alternatives --auto <name>  
  9.        alternatives --config <name>  
  10.        alternatives --display <name>  
  11.        alternatives --set <name> <path>  
  12.   
  13. common options: --verbose --test --help --usage --version  
  14.                 --altdir <directory> --admindir <directory>  

 

3、实例

 

举个使用例子吧,改变系统bin默认java的指向:

 

Linux代码   收藏代码
  1. 安装  
  2. #alternatives --install /usr/bin/java java /home/server/jdk1.6 .0_21/bin/java  300   
  3.   
  4. 查询  
  5. #alternatives --display java  
  6.   
  7. 删除  
  8. #alternatives --remove java  /home/server/jdk1.6 .0_21/bin/java  

 

4、总结

 

      1、alternatives和update-alternatives其实一个东东,都指向alternatives。

      2、网上找了一个说明(也不知道对不对)

           用于存放系统的一些默认打开程序的信息和配置, 比如默认的编辑器、默认的网络浏览器、 默认的图形登陆器、默认的鼠标指针  等。

 

你可能感兴趣的:(linux,命令)