Linux Package Management Commands

Yes, some distros still use rpm.

Extract files from an RPM:

rpm2cpio filename.rpm | cpio -idv

Unpack an RPM into /tmp/deleteme without installing it:

rpm -ivh -root /tmp/deleteme --nodeps --noscripts package.rpm

Install

rpm -ivh

Upgrade (use this except for kernels)

rpm -Uvh

Find out what's installed

rpm -qa

See which package a file belongs to

rpm -qf

List files provided by a package

rpm -ql

Show detailed info for a package

rpm -qi

List packages by install date (useful for finding old packages)

rpm -qa --last

yum and apt

Clean up old remnants:

yum clean oldheaders
yum clean packages

Run apt-get on a list of systems in parallel

for HOST in $(cat hostlist.txt); do eval `ssh $HOST "sudo apt-get update" `; done

Search for packages containing "cyr"

apt-cache search cyr