article in Tech
linux-unix-and-friends
RPM - package management for linux
So I sorta have a love hate relationship with RPM. It is available on most every distro out there.... so I'm sorta stuck with it. I actually like apt better but I deal.
The best place to find out information on how to do things with RPM is to read:
Maximum RPM -> http://www.rpm.org/max-rpm/index.html
However, I always just want someplace quick to go for the commands I commonly use... So I've made this simple page to help me remember.
Finding the Largest Installed Packages(and list all your packages)
This is really useful if you've got a system that is bogged down with a bunch of rpms and you wanna prune out some of them.
rpm -qa --queryformat '%{name}-%{version}-%{release} %{size}\n' | sort -nr +1
Finding Recently Installed Packages
This command will return a list of packages in order of install date.
rpm -qa --queryformat '%{installtime} %{name}-%{version}-%{release} %{installtime:date}\n' | sort -nr +1 | sed -e 's/^[^ ]* //'
Finding Similar Packages
This command would give you back a list of all the rpms in the group "shells"
rpm -qa --queryformat '%10{NAME} %20{GROUP}\n' | grep -i shells
Info on uninstalled packages
This command lists out information about the uninstalled package.
rpm -qpil foo.bar
Remove all packages with name containing...
This command if pretty neato if you ask me. Basically just list out all the packages that contain your requested string, save it to a file, review, and execute!
Also, you'll notice that I'm not ignoring deps here. You'll run the generated script once... get a bunch of interelated dependency problems. Then the second time you'll have resolved most of them. If a third time around it gives you troubles, you'll have to resolve by hand those troublesome packages.
rpm -qa --queryformat 'echo \"Removing %{name}-%{version}-%{release}.\";rpm -e %{name}-%{version}-%{release}\n'| sort -nr +1 | grep gnome > removegnome
Querying Info from Packages
How do I see a list of all installed packages on my computer? rpm -qa | less
I don't know what a certain installed package does. How can I get it to tell me about itself? rpm -qi package
How do I ask what files were installed by a certain installed package? rpm -ql package
How do I get a-yet-uninstalled package to give me information about itself and the files it would install on my computer? rpm -qilp package.rpm
There's a file on my computer called /usr/bin/weirdo. How can I find out which installed package it belongs to? rpm -qf /usr/bin/weirdo
How do I find out which package installed /usr/bin/weirdo, AND how do I get information on that package and see all the other files it installed? rpm -qilf /usr/bin/weirdo
Verifying Packages
I deleted a few files by accident, but I don't know what they are. Can rpm show me which files in its database are now missing? rpm -Va
I think I've been hacked! How do I check for files that have been modified or removed in any way? rpm -Va
'rpm -Va' takes a long time. How do I just verify that a certain package is OK? rpm -Vv package
How do I test the integrity of a yet-uninstalled package file? rpm -K --nopgp package.rpm
Created: 2005-08-18 06:01:37
Modified: 2005-09-10 05:41:50