RPM Usage

Preferred method to manage packages in Fedora is yum. rpmreaper is an useful tool to analyse package dependencies.

Query

$ rpm -qf ⟨file⟩
query package owning file (file has to be with a full path).

$ rpm -qp --changelog http://server/package.rpm
show change log of the package.

$ rpm -ql ⟨package⟩
list content of the package .

$ rpm -q --whatrequires ⟨package⟩
show packages that require this package.

$ rpm -qa -last | tac
list all installed packages sorted by time (install time).

$ rpm -qa --queryformat '%10{size} %{name}-%{version}\n' | sort -n
list all installed packages sorted by size.

$ rpm -qa | grep ⟨pattern⟩
list packages filtered according to the pattern.

Instal, Uninstall, Test

# rpm -Uvh ⟨package⟩
-U   install package, remove older one if such exists;   -v   verbose;   -h   show hashing marks during installation (or --percent).   --oldpackage   install older package.

# rpm -e ⟨package⟩
remove package

# rpm -U --test ⟨package⟩
test package installation, do not install. Nothing will be printed if the test was passed without any problems.

List, Extract RPM without Installing

$ rpmls ⟨path-to-rpm⟩   list content of rpm. rpmdevtools has to be installed.

$ rpm2cpio ⟨path-to-rpm⟩ | cpio -iumdv

or, if you have installed rpmdevtools

$ rpmdev-extract ⟨path-to-rpm⟩
extract all files from rpm into current directory.

Additional Info

Edward C. Bailey, Taking the Red Hat Package Manager to the Limit