One of my friend was trying to see , which rpm/package provide /usr/bin/java in his system by below method..
[root@ ~]# which java
[root@ ~]# rpm -qf /usr/bin/java
file /usr/bin/java is not owned by any package
Its a common practice that checking a particular file/binary is provided by which rpm using rpm command as shown above.
But what will you do if you see the message like “is not owned by package” ? .. In such situations ,you have to look into something called “alternatives” .
Some of the binaries can be configured using “alternatives” ..
alternatives – maintain symbolic links determining default commands
alternatives creates, removes, maintains and displays information about the symbolic links comprising the alternatives system.
The alternatives system is a reimplementation of the Debian alternatives system. It was rewritten primarily to remove the
dependence on perl; it is intended to be a drop in replacement for Debian’s update-dependencies script. This man page is a
slightly modified version of the man page from the Debian project.
It is possible for several programs fulfilling the same or similar functions to be installed on a single system at the same
time. For example, many systems have several text editors installed at once. This gives choice to the users of a system,
allowing each to use a different editor, if desired, but makes it difficult for a program to make a good choice of editor to
invoke if the user has not specified a particular preference.
PLEASE READ man page of alternatives for more details on this ..
Alternatives got below options with it.
alternatives version 22.214.171.124 – 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>
[–slave <link> <name> <path>]*
alternatives –remove <name> <path>
alternatives –auto <name>
alternatives –display <name>
alternatives –set <name> <path>
common options: –verbose –test –help –usage –version
Now something like below, can be tried.
[root@ ~]# alternatives –config java
There are 3 programs which provide ‘java’.
+ 1 /usr/lib/jvm/jre-1.6.0-
* 2 /usr/lib/jvm/jre-1.6.0-sun.
If you want to know which PACKAGE provides above binaries , go for “rpm command” now with the links you got from above..
[root@ ~]# rpm -qf /usr/lib/jvm/jre-1.6.0-sun.