Some rpm quirks that can come quite handy sometimes. Specially for the ones who do not know how the rpm and spec files work
.
The first one goes to a quick command which displays the top packages that use the most of your hard drive:
rpm -qa --qf="%{size} %{name}\n" | sort -n
This will list all installed packages, sorting them by size. There are some limitations for that (for example, it does not works nicely with hard links), but it gives you a big picture.
The second one goes to the:
rpm -qf /path/to/some/file
This will display which package the file you are looking at belongs to.
The third complements the third, and it is:
rpm -Vf /path/to/some/file
It will discover to what package the file belongs to, and verify if this package was changed since the install. So if something suddenly stopped working, and you are unable to figure out why by looking at the configuration file, this could come handy.
Next one goes to:
rpm -qf --scripts /path-to-some-file
If you notice that some command gets executed right after a package is installed, and the only thing you know about this package is one file it provides, this will show all such commands.
Fifth is:
rpm -qa --qf '%{license}\n' | sort | uniq
This will show you all the licenses of all packages you have installed on the system.
And a bonus one goes to:
rpm -qf --changelog /path/to/a/file
which shows the whole package changelog for the package that contains a specific file. This helps you find someone to blame when a package stops working
.











