apt install nginx, and see it on every other system, or browse the 33 everyday tasks below.It translates the command, not package names: Apache is apache2 on Debian and Ubuntu but httpd on Fedora and RHEL. Got an error from apt or dnf? Try the Error Message Decoder.
Commands that change the system need sudo (or an administrator terminal on Windows). Don't run Homebrew with sudo. Click any command to copy it.
| Task | aptDebian, Ubuntu, Mint, Pop!_OS | dnfFedora, RHEL 8+, Rocky, Alma | pacmanArch, Manjaro, EndeavourOS | zypperopenSUSE, SUSE Linux Enterprise | apkAlpine Linux and many Docker images | HomebrewmacOS | wingetWindows 10 and 11 |
|---|---|---|---|---|---|---|---|
| Everyday | |||||||
| Refresh the package lists | apt update | dnf makecachednf also refreshes on its own when the lists are old | pacman -SyuRefresh and upgrade together. Don't run pacman -Sy and then install: that's a partial upgrade, which Arch doesn't support | zypper refresh | apk update | brew update | winget source update |
| Upgrade all packages | apt upgradeRun apt update first. apt full-upgrade also adds or removes packages when an upgrade needs it | dnf upgrade | pacman -Syu | zypper updateOn openSUSE Tumbleweed use zypper dup | apk upgradeapk -U upgrade refreshes the lists first | brew upgrade | winget upgrade --all |
| Upgrade one package | apt install --only-upgrade <pkg>Upgrades it only if it is already installed | dnf upgrade <pkg> | Not supported: Arch expects everything to be upgraded together with pacman -Syu | zypper update <pkg> | apk add --upgrade <pkg> | brew upgrade <pkg> | winget upgrade <pkg> |
| Install a package | apt install <pkg> | dnf install <pkg> | pacman -S <pkg> | zypper install <pkg> | apk add <pkg> | brew install <pkg> | winget install <pkg>Use --id <Package.Id> -e for an exact match |
| Remove a package | apt remove <pkg> | dnf remove <pkg> | pacman -R <pkg>pacman -Rs also removes dependencies nothing else needs | zypper remove <pkg>Add --clean-deps to remove dependencies nothing else needs | apk del <pkg> | brew uninstall <pkg> | winget uninstall <pkg> |
| Remove a package and its config files | apt purge <pkg> | No separate command: dnf remove deletes unchanged configs and keeps edited ones as .rpmsave | pacman -Rn <pkg>-Rns also removes dependencies nothing else needs | No separate command: edited configs are kept as .rpmsave | apk del --purge <pkg> | brew uninstall --zap <pkg>Casks (apps) only | No equivalent |
| Remove dependencies nothing needs any more | apt autoremove | dnf autoremove | pacman -Qdtq | pacman -Rns -Shows an error if there are none | zypper packages --unneededLists them; remove with zypper remove | Not needed: apk removes them automatically | brew autoremove | No equivalent |
| Reinstall a package | apt install --reinstall <pkg> | dnf reinstall <pkg> | pacman -S <pkg> | zypper install --force <pkg> | apk fix -r <pkg> | brew reinstall <pkg> | Uninstall, then install again |
| Install a downloaded package file | apt install ./<file>Keep the ./ so apt treats it as a file, not a package name | dnf install ./<file> | pacman -U ./<file> | zypper install ./<file> | apk add --allow-untrusted ./<file>Only for files you trust; the flag skips the signature check | No equivalent for package files | Run the downloaded installer directly |
| Download a package without installing it | apt download <pkg> | dnf download <pkg> | pacman -Sw <pkg> | zypper install --download-only <pkg> | apk fetch <pkg> | brew fetch <pkg> | No equivalent in all versions |
| Finding things | |||||||
| Search for a package | apt search <term> | dnf search <term> | pacman -Ss <term> | zypper search <term> | apk search <term> | brew search <term> | winget search <term> |
| Show details about a package | apt show <pkg> | dnf info <pkg> | pacman -Si <pkg>Use pacman -Qi for an installed package | zypper info <pkg> | apk info -a <pkg> | brew info <pkg> | winget show <pkg> |
| List installed packages | apt list --installed | dnf list --installed | pacman -Q | zypper search --installed-only | apk list --installedOr apk info for names only | brew list | winget list |
| List packages you installed yourself | apt-mark showmanual | dnf repoquery --userinstalled | pacman -Qe | No direct equivalent | cat /etc/apk/worldThe world file lists what you asked for | brew leavesFormulae that nothing else depends on | No equivalent |
| List packages with updates available | apt list --upgradableRun apt update first | dnf check-update | checkupdatesFrom pacman-contrib; safe because it uses a separate copy of the lists. pacman -Qu works after a full -Syu | zypper list-updates | apk list --upgradable | brew outdated | winget upgradeWith no arguments it lists available upgrades |
| Which package owns this file? | dpkg -S <path> | rpm -qf <path> | pacman -Qo <path> | rpm -qf <path> | apk info --who-owns <path> | No equivalent (Homebrew files live under its Cellar folder) | No equivalent |
| List the files a package installed | dpkg -L <pkg> | rpm -ql <pkg> | pacman -Ql <pkg> | rpm -ql <pkg> | apk info -L <pkg> | brew list <pkg> | No equivalent |
| Which package provides a command I don't have? | apt-file search bin/<cmd>Install it once: apt install apt-file && apt-file update | dnf provides '*/bin/<cmd>' | pacman -F <cmd>Run pacman -Fy once to download the file lists | zypper search --provides /usr/bin/<cmd> | apk search 'cmd:<cmd>' | No built-in equivalent | No equivalent |
| Show what a package depends on | apt-cache depends <pkg> | dnf repoquery --requires <pkg> | pactree <pkg>From pacman-contrib; pacman -Qi <pkg> also lists "Depends On" | zypper info --requires <pkg> | apk info -R <pkg> | brew deps <pkg> | No equivalent |
| Show what depends on a package | apt-cache rdepends --installed <pkg>Without --installed it includes packages you don't have | dnf repoquery --installed --whatrequires <pkg> | pactree -r <pkg>From pacman-contrib | zypper search --requires <pkg> | apk info -r <pkg> | brew uses --installed <pkg> | No equivalent |
| Versions and holds | |||||||
| Show the versions available | apt list -a <pkg>Or apt-cache policy <pkg>, which also shows each repository | dnf list --showduplicates <pkg> | Repositories carry one version; older ones are in /var/cache/pacman/pkg or the Arch Linux Archive | zypper search -s <pkg> | apk policy <pkg> | brew info <pkg>Other versions exist only as separate formulae such as python@3.11 | winget show <pkg> --versions |
| Install a specific version | apt install <pkg>=<ver> | dnf install <pkg>-<ver>To go back a version: dnf downgrade <pkg> | pacman -U <file>Using an older package file from /var/cache/pacman/pkg | zypper install <pkg>=<ver>Add --oldpackage to downgrade | apk add <pkg>=<ver>This also pins it to that version | brew install <pkg>@<ver>Only where a versioned formula exists | winget install <pkg> --version <ver> |
| Hold a package at its current version | apt-mark hold <pkg> | dnf versionlock add <pkg>Built into dnf5; on dnf4 install python3-dnf-plugin-versionlock first | Add it to the IgnorePkg line in /etc/pacman.conf | zypper addlock <pkg> | apk add <pkg>=<ver>Pins it in /etc/apk/world | brew pin <pkg> | winget pin add <pkg> |
| Release a hold | apt-mark unhold <pkg> | dnf versionlock delete <pkg> | Remove it from IgnorePkg in /etc/pacman.conf | zypper removelock <pkg> | apk add <pkg>Adding it again without a version removes the pin | brew unpin <pkg> | winget pin remove <pkg> |
| List held packages | apt-mark showhold | dnf versionlock list | grep IgnorePkg /etc/pacman.conf | zypper locks | cat /etc/apk/world | brew list --pinned | winget pin list |
| Cleaning and repair | |||||||
| Clear the download cache | apt cleanapt autoclean removes only files that can no longer be downloaded | dnf clean all | pacman -Scpaccache -r (pacman-contrib) keeps the last three versions, which is safer for downgrades | zypper clean | apk cache cleanOnly does something if a local cache is set up | brew cleanup | No equivalent |
| Fix broken or half-installed packages | apt --fix-broken installAfter an interrupted install, run dpkg --configure -a first | dnf checkReports problems; then reinstall or dnf distro-sync the packages it names | pacman -DkChecks that dependencies are met | zypper verify | apk fix | brew doctorDiagnoses problems and suggests fixes | No equivalent |
| Show the install history | less /var/log/apt/history.log | dnf history | less /var/log/pacman.log | less /var/log/zypp/history | No history log | No history log | No history log |
| Undo the last transaction | No undo; reinstall or remove by hand using the history log | dnf history undo last | No undo; reinstall older files from the cache | No undo; on Btrfs systems, roll back with snapper | No undo | No undo | No undo |
| Repositories | |||||||
| List the repositories in use | apt policyThe files live in /etc/apt/sources.list and /etc/apt/sources.list.d/ | dnf repolist | pacman-conf --repo-list | zypper repos | cat /etc/apk/repositories | brew tap | winget source list |
| Add a repository | add-apt-repository ppa:<name>Ubuntu PPAs. For other repositories, add a file in /etc/apt/sources.list.d/ with its signing key | dnf config-manager addrepo --from-repofile=<url>dnf5 syntax; dnf4 uses dnf config-manager --add-repo <url> | Add a [repo] section to /etc/pacman.conf | zypper addrepo <url> <name> | echo '<url>' >> /etc/apk/repositoriesThen run apk update | brew tap <name> | winget source add --name <name> --arg <url> |
| Moving to a new machine | |||||||
| Save a list of what you installed | apt-mark showmanual > pkgs.txt | dnf repoquery --userinstalled > pkgs.txt | pacman -Qqe > pkgs.txt | No direct equivalent | cp /etc/apk/world pkgs.txt | brew bundle dumpWrites a Brewfile | winget export -o pkgs.json |
| Install everything from that list | xargs -a pkgs.txt apt install | xargs -a pkgs.txt dnf install | pacman -S --needed - < pkgs.txt | No direct equivalent | apk add $(cat pkgs.txt) | brew bundleReads the Brewfile in the current folder | winget import -i pkgs.json |
No tasks match that filter.
Not sure? cat /etc/os-release names your Linux distribution.