The worst thing about commercial Linux is RPM. I can never remember the command line incantations required for even fairly simple tasks.
While yum eventually takes away the pain of applying software updates — so long as you’re not in a hurry — there are all kinds of other tasks it doesn’t handle. I therefore rely on an RPM cheat sheet I’ve assembled over the years. Here’s a copy for anyone else who might find it useful.
Command | Purpose |
---|---|
rpm -e package-1.2.3-gm | Erase named package from system |
rpm -i package-1.2.3-gm.rpm | Install package file into system |
rpm -U package-1.2.3-gm | Upgrade package |
rpm -F package1 package2 | Upgrade packages to latest versions in an appropriate order |
rpm -Fvh * | Upgrade a bunch of packages from the matching RPM files |
rpm -q package | Returns full name and version of installed package |
rpm -qp package.rpm | Same for a non-installed package |
rpm -qi package | Returns misc details about package |
rpm -qpi package.rpm | Same for a non-installed package |
rpm -qa | List all installed packages |
rpm -qf file | Which package put this file here? |
rpm -ql package | List of files in an installed package |
rpm -qlp package.rpm | Same for files in a non-installed package |
rpm -qRl package | List dependencies of an installed package |
rpm -qR package.rpm | List dependencies of a non-installed package |
rpm -ivh package.src.rpm | Install a source RPM, spec goes into /usr/src/RedHat/SPECS |
rpmbuild -ba package.spec | Build from installed source installed |
Also, to list installed software packages in order of size, with descriptions:
rpm -qa --queryformat="%10{size} %{NAME} - %{SUMMARY}n" | sort -k1,1nr
Notes:
- Wildcards work with filenames, but not with package names.
- Any package filename argument can be replaced with a full URL of where to get the package from.
--test
to see what a command would do without actually doing it.-v
for verbose output.