↑↑ 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/Rocky Debian/Ubuntu Arch Void Gentoo FreeBSD OpenBSD
Install package dnf install <package> apt install <package> pacman -S <package> xbps-install <package> emerge <package> pkg install <package> pkg_add <package>
Install package file rpm -i <package file> dpkg -i <package file> pacman -U <package file> xbps-install <package file> (?) pkg install <package file> ?
Uninstall package rpm -e <package> apt remove <package> pacman -R <package> xbps-remove <package> emerge --depclean <package> pkg delete <package> pkg_delete <package>
Show package description rpm -qi <package> apt show <package> pacman -Si <package> xbps-query <package> emerge -s %^<package>$ pkg search -f -e <package> pkg_info <package>
Search for available package by substring dnf list \*<string>\* apt search <string> pacman -Ss <string> xbps-query -R -s <string> emerge -s <string> pkg search <string> pkg_info -Q <string>
List installed packages rpm -qa dpkg -l -a pacman -Q xbps-query -l equery list \* pkg info pkg_info -a
Search for installed package by substring dnf list --installed \*<string>\* dpkg -l '*<string>*' pacman -Qs <string> xbps-query -s <string> equery list '*<string>*' pkg info -x -i <string> pkg_info -a | grep <string>
Find installed package containing file rpm -qf <file> dpkg -S <file> pacman -Qo <file> xbps-query -o <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> xbps-query -f <package> equery files <package> pkg info -l <package> pkg_info -L <package>
Find available package containing file dnf repoquery -f <path> apt-file find <path> pkgfile <path> xbps-query -R -o <path> ? ? ?
List package dependencies dnf repoquery --deplist <package> apt-cache showpkg <package> pactree <package> xbps-query -x <package> equery depgraph <package> pkg info -d <package> (pkg_info -S <package>)
List reverse dependencies dnf repoquery --whatdepends <package> apt-cache showpkg <package> pactree -r <package> xbps-query -X <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.


TOS / Impressum