You now know that an RPM database on the system keeps track of which files are associated with each RPM installed, but how do you know which files are associated with which RPM packages? You can query the RPM database and find out with the following command:
rpm -qf <filename>
The <filename> must be the full path to the file. If the file is associated with an RPM package installed, the name of the package and the version installed is displayed. For example, if the
rpm -qf /etc/crontab command is issued, the output is crontabs <version>-<release>,
where <version>-<release> is the version
and release of the
crontabs package installed.
Tip
If the file is a command already in your PATH environment variable, use the following
syntax instead of typing the entire path to the file,:
rpm -qf `which <filename>’
Notice the command contains back ticks,
not apostrophes. The back ticks tell the shell
to execute the command inside them and use that as part of the overall command.
You also know that configuration files are marked as configuration
files in the RPM data base when they are installed. To retrieve a list of configuration files from a package
installed, use the following
command:
rpm -qc <packagename>
If any files from the package were marked as configuration files when the package was created, a list of them will be displayed.
A similar query can be performed
to list any documentation files installed with a package:
rpm -qd <packagename>
Documentation files include man pages and text or HTML formatted files in
/usr/share/doc/ installed by the package.
Each time a package is changed, the developer is responsible for adding a changelog entry
to describe the change. This becomes part of the information provided
by the RPM package.
The query option has the ability to show the changelog
for the package with the following command:
rpm -q --changelog
<packagename>
These query commands can also be performed on an RPM package file instead of on the package name of the package already installed. To do so, add the -p argument followed by the full or relative path to the package file.
For example, to view the changelog of a
package before installing
it, use the following command:
rpm -q --changelog -p <packagename>-<version>-<release>.<arch>.rpm
0 comments:
Post a Comment