Total Pageviews

Monday 18 June 2012

package management — quick command reference


I will not be dealing with package management frontends such as apt-get, pkg_get, smart, yast, yum, or anything where you would only have to say `foo install packagename`. Now, there is:
RPM Package Manager
duhpkg
Solaris pkg*
Arch/Pacman
Never use something like `rpm -e $(rpm -qa | grep kde)` because it will remove all the packages that have kde in their name, NOT JUST the ones that begin with kde. Such careless use may remove important packages. In general, `rpm -qa | grep kde` is almost useless because you could have written `rpm -qa "*kde*"` instead.
(The list is incomplete, esp. with Solaris pkg, so if anyone knows, please notify me.)
List all packages in short form:
rpm -qa
dpkg-query -W
pkginfo
pacman -Q
List information about a package:
rpm -qi bash
dpkg -s bash
pkginfo -l SUNWbash
pacman -Qi
List information about a package (file):
rpm -qip bash.x86_64.rpm
dpkg -l bash.deb
pacman -Qpi
List files of a package (installed):
rpm -ql bash
dpkg -L bash
pkgchk -l SUNWbashr | grep Pathname:
pacman -Ql
List files of a package (file):
rpm -qlp bash.x86_64.rpm
dpkg -c bash.deb
pacman -Qlp
List everything (info, file list with permissions, sizes, ownership, etc.):
rpm -qilvp bash.x86_64.rpm
Package to own a file:
rpm -qf /bin/bash
dpkg -S /bin/bash
pkgchk -l -p /bin/bash
pacman -Qo
Package to own a file or provide a file or virtual object:
rpm -q --whatprovides "libc.so.6(GLIBC_2.4)"
Packages to require a file or virtual object:
rpm -q --whatrequires libm.so.6
List requirements of a package (installed):
rpm -qR bash
pacman -Qi
List requirements of a package (file):
rpm -qRp bash.x86_64.rpm
pacman -Qpi
Install one or more packages (common options):
rpm -Uhv bash.x86_64.rpm
dpkg -i bash.deb
pacman -U bash...
Remove one or more packages:
rpm -e bash
dpkg -P bash
pkgrm SUNWbashr
pacman -R bash
Build a package from specfile:
rpmbuild -ba bash.spec
[Arch Build System]
Build a package from package:
rpmbuild --rebuild -bb bash.src.rpm
Extract a package to current directory:
rpm2cpio bash.rpm | cpio -diu
dpkg -x bash.deb $PWD

from http://inai.de/linux/adm_pack