Catalog / Package Managers Cheat Sheet (apt, yum, brew)

Package Managers Cheat Sheet (apt, yum, brew)

A quick reference guide to common package management commands for apt (Debian/Ubuntu), yum (CentOS/RHEL), and brew (macOS). This cheat sheet provides essential commands for installing, updating, removing, and managing software packages on different operating systems.

apt - Debian/Ubuntu

Basic Package Management

sudo apt update

Update the package lists.

sudo apt upgrade

Upgrade all upgradable packages.

sudo apt install <package_name>

Install a new package.

sudo apt remove <package_name>

Remove a package (leaving configuration files).

sudo apt purge <package_name>

Remove a package and its configuration files.

sudo apt autoremove

Remove automatically installed dependencies that are no longer needed.

Package Information

apt show <package_name>

Show detailed information about a package.

apt list --installed

List all installed packages.

apt search <keyword>

Search for packages by keyword.

apt depends <package_name>

Show the dependencies of a package.

Managing Repositories

/etc/apt/sources.list

Main configuration file for APT repositories.

/etc/apt/sources.list.d/

Directory for additional repository files.

sudo add-apt-repository <repository>

Add a new repository (e.g., PPA).

sudo apt update

Update package lists after adding a repository.

yum - CentOS/RHEL

Basic Package Management

sudo yum update

Update all packages.

sudo yum install <package_name>

Install a new package.

sudo yum remove <package_name>

Remove a package.

sudo yum autoremove <package_name>

Remove a package and its dependencies.

sudo yum clean all

Clean up cached package data.

Package Information

yum info <package_name>

Show detailed information about a package.

yum list installed

List all installed packages.

yum search <keyword>

Search for packages by keyword.

yum provides <file_name>

Find which package provides a specific file.

Managing Repositories

/etc/yum.repos.d/

Directory for yum repository configuration files.

yum repolist

List all enabled yum repositories.

yum install yum-utils

Install yum-utils package, provides useful utilities.

yumdownloader <package_name>

Download an RPM package without installing it (requires yum-utils).

brew - macOS

Basic Package Management

brew update

Update Homebrew itself.

brew upgrade

Upgrade all outdated packages.

brew install <package_name>

Install a new package.

brew uninstall <package_name>

Uninstall a package.

brew cleanup

Remove older versions of installed packages.

Package Information

brew info <package_name>

Show information about a package.

brew list

List installed packages.

brew search <keyword>

Search for packages by keyword.

brew deps <package_name>

Show dependencies for a package.

Managing Brew

brew doctor

Diagnose potential problems with your brew setup.

brew config

Display Homebrew’s configuration info.

brew cask install <cask_name>

Install a cask (GUI application).

brew tap <user/repo>

Add a new tap (unofficial repository).

Common Operations Across Package Managers

Finding Packages

apt search <package_name>
yum search <package_name>
brew search <package_name>

Search for a package by name or description.

apt list --installed
yum list installed
brew list

List all installed packages.

Updating Packages

apt update && apt upgrade
yum update
brew update && brew upgrade

Update the package list and upgrade packages.

apt autoremove
yum autoremove
brew cleanup

Remove unneeded dependencies and clean up old versions.

Installing and Removing

apt install <package_name>
yum install <package_name>
brew install <package_name>

Install a specific package.

apt remove <package_name>
yum remove <package_name>
brew uninstall <package_name>

Remove a specific package.