Package management cheatsheet
apt-get
: Ubuntu, Debian
apk
: Alpine
dnf
: Rocky
brew
: macOS
pacman
: Arch
Install a package
$ apt-get install PKG
$ apk add PKG
$ dnf install PKG
$ brew install PKG
$ pacman -S PKG
Install specific version
$ apt-get install PKG=VERSION
# TODO: apk
$ dnf install PKG-VERSION
# TODO: brew
# TODO: pacman
Update a package
$ apt-get upgrade PKG
# TODO: apk
$ dnf update PKG
$ brew upgrade PKG
# TODO: pacman
Uninstall a package
$ apt-get remove PKG
$ apk del PKG
$ dnf remove PKG
$ brew uninstall PKG
$ pacman -Rs PKG
List installed packages
$ dpkg --list
$ apk list --installed
$ dnf list --installed
$ brew list
$ pacman -Q # -Qe shows only explicitly installed
Remove unneeded packages
$ apt-get autoremove
# TODO: apk
$ dnf autoremvoe
# TODO: brew
# TODO: pacman
Show package details
$ apt show PKG
$ apk info PKG
$ dnf info PKG
$ brew info PKG
# TODO: pacman
Search for package
$ apt-cache search KEYWORD
$ apk search KEYWORD
$ dnf search git
$ brew search git
# TODO: pacman
Find package that provides binary
# TODO: apt-get
# TODO: apk
$ dnf provides CMD
# TODO: brew
$ pacman -F FILE
Repository files
- APT:
/etc/apt/sources.list
and /etc/apt/sources.list.d/
- DNF:
/etc/yum.repos.d
- Look for
reposdir
config in output of dnf config-manager --dump
Links
See also