↑↑ Home ↑ UNIX  

Linux / BSD package manager cheat sheet

When you have several Linux and BSD boxes or help several people administer theirs, you often have to deal with different distributions and their package managers. This table is a cheat sheet to answer the frequent question "how do you do that under that distribution again?".

Action Redhat, SuSE, Mandriva Ubuntu Arch Gentoo FreeBSD OpenBSD
Install package rpm -i <package file> aptitude install <package> pacman -S <package> emerge <package> pkg install <package> pkg_add <package>
Uninstall package rpm -e <package> aptitude remove <package> pacman -R <package> emerge --depclean <package> pkg delete <package> pkg_delete <package>
Show package description rpm -qi <package> aptitude show <package> pacman -Si <package> emerge -s %^<package>$ pkg search -f -e <package> pkg_info <package>
Search for available package by substring ? aptitude search <string> pacman -Ss <string> emerge -s <string> pkg search <string> pkg_info -Q <string>
List installed packages rpm -qa dpkg -l -a pacman -Q equery list \* pkg info pkg_info -a
Search for installed package by substring ? dpkg -l '*<string>*' pacman -Qs <string> equery list '*<string>*' pkg info -g '*<string>*' pkg_info -a | grep <string>
Find package containing file rpm -qf <file> dpkg -S <file> pacman -Qo <file> equery belongs <file> pkg which <file> pkg_info -E <file>
pkg_locate <file>
List files in package rpm -ql <package> dpkg -L <package> pacman -Qlq <package> equery files <package> pkg info -l <package> pkg_info -L <package>
List package dependencies ? ? pactree <package> equery depgraph <package> pkg info -d <package> (pkg_info -S <package>)
List reverse dependencies ? ? pactree -r <package> equery depends <package> pkg info -r <package> pkg_info -R <package>

For a more extensive one-to-one comparison of Linux package managers, see the "Pacman Rosetta" at the Arch Linux wiki.