When you install a Linux/UNIX system, probably one of the first tasks you do is installing a program. If you are using a system you don’t know, here you can find what is the default package manager in your Linux system and how to use it.

When using the following commands, you may need to use “sudo”/”doas” or be a root user.

Table of Contents

apt (Debian/Ubuntu)

  • Update repositories
    apt update
    
  • Upgrade installed packages
    apt upgrade
    
  • Search a package in repositories
    apt search <search term>
    
  • Install a package
    apt install <package name>
    
  • Uninstall a package
    apt remove <package name>
    
  • Remove unneeded dependencies
    apt autoremove
    
  • List upgradable packages
    apt list --upgradable
    
  • List installed packages
    apt list --installed
    
  • Install a .deb file
    dpkg -i <deb file>
    
  • Info about a package
    apt show <package name>
    

pacman (Arch Linux, Manjaro, EndevourOS)

  • Update repositories
    pacman -Sy
    
  • Upgrade installed packages
    pacman -Su
    
    • Add --noconfirm to automatically answer yes to prompts.
  • Update repos and then upgrade installed packages
    pacman -Syu
    
  • Search a package in repositories
    pacman -Ss <search term>
    
  • Install (or update) a package
    pacman -S <package name>
    
  • Uninstall a package
    pacman -R <package name>
    # add '--nosave' to remove config files
    # '-s' to remove unnecessary dependencies
    
  • Install a pakage file
    pacman -U package.pkg.tar.xz
    
  • List unneeded dependencies
    pacman -Qdt
    
  • List upgradable packages
    pacman -Qu
    
  • List installed packages
    pacman -Q
    
  • Search for an installed package
    pacman -Qs <search term>
    
  • Remove cache (downloaded packages)
    paccache -r
    
    • -k <number>: keep at least <number> versions of every package (default: 3).
    • You can enable and start paccache.timer to automate this task.
  • Info about a package
    pacman -Si <package name>
    

apk (Alpine Linux)

  • Update repositories
    apk update
    
  • Upgrade installed packages
    apk upgrade
    
  • Search a package in repositories
    apk search <search term>
    
  • Install a package
    apk add <package name>
    
  • Uninstall a package
    apk del <package name>
    
  • Info about a package
    apk info <package name>
    

dnf (Fedora/CentOS/Oracle Linux)

  • Update repositories
    dnf check-update
    
  • Upgrade installed packages (also updates repositories)
    dnf upgrade
    
  • Search a package in repositories
    dnf search <search term>
    
  • Install a package
    dnf install <package name>
    
  • Uninstall a package
    dnf remove <package name>
    
  • Info about a package
    dnf info <package name>
    

yum (Amazon Linux/Fedora/CentOS/Oracle Linux)

  • Update repositories
    yum check-update
    
  • Upgrade installed packages (also updates repositories)
    yum upgrade
    
  • Search a package in repositories
    yum search <search term>
    
  • Install a package
    yum install <package name>
    
  • Install a RPM package
    yum localinstall <rpm file>
    
  • Uninstall a package
    yum erase <package name>
    
  • Info about a package
    yum info <package name>
    

zypper (OpenSUSE)

  • Update repositories
    zypper refresh
    
  • Upgrade installed packages
    zypper update
    
  • Search a package in repositories
    zypper search <search term>
    
  • Install a package
    zypper install <package name>
    
  • Uninstall a package
    zypper remove <package name>
    

pkg (FreeBSD)

  • Update repositories
    pkg update
    
  • Upgrade installed packages
    pkg upgrade
    
  • Search a package in repositories
    pkg search <search term>
    
  • Install a package
    pkg install <package name>
    
  • Uninstall a package
    pkg remove <package name>
    

pkg_add, pkg_info, pkg_delete (OpenBSD)

  • Upgrade installed packages
    pkg_add -y <package name>
    
  • Search a package in the repository
    pkg_info <package name>
    
  • Install a package
    pkg_add <package name>
    
  • Uninstall a package
    pkg_delete <package name>
    

emerge (Gentoo)

  • Update repository
    emerge --sync
    
  • Upgrade installed packages
    emerge --update @world
    # add --ask to ask confirmation before upgrade
    # add --deep to include dependencies
    
  • Search a package in repository
    emerge --search <search term>
    # add --searchdesc to search through the descriptions
    
  • Install a package
    emerge <package name>
    
  • Uninstall a package
    emerge --deselect <package name>
    

xbps (Void)

  • Update repositories
    xbps-install -S
    
  • Upgrade installed packages
    xbps-install -u
    
  • Search a package in repositories
    xbps-query -R <search term>
    
  • Install a package
    xbps-install <package name>
    

pkcon (Nitrux)

  • Update repositories
    pkcon refresh
    
  • Upgrade installed packages (also updates repositories)
    pkcon update
    
  • Search a package in repositories
    pkcon search <search term>
    
  • Install a package
    pkcon install <package name>
    
  • Uninstall a package
    pkcon remove <package name>
    

slackpkg (Slackware, Slax)

  • Update repositories
    slackpkg update
    
  • Upgrade a package
    slackpkg upgrade <package name>
    
  • Upgrade the system
    slackpkg upgrade-all
    
  • Search a package
    slackpkg search <search term>
    
  • Install a package
    slackpkg install <package name>
    
  • Uninstall a package
    slackpkg remove <package name>
    
  • Info about a package
    slackpkg info <package name>
    

eopkg (Solus)

  • Upgrade installed packages
    eopkg upgrade
    
  • Search a package
    eopkg search <search term>
    
  • Install a package
    eopkg install <package name>
    
  • Uninstall a package
    eopkg remove <package name>
    

guix (Guix system)

  • Download and deploy the latest version of Guix
    guix pull
    
  • Upgrade installed packages
    guix upgrade
    # or
    guix package -u
    
  • Search a package
    guix search <search term>
    
  • Install a package
    guix install <package name>
    # or
    guix package -i <package name>
    
  • Uninstall a package
    guix remove <package name>
    # or
    guix package -r <package name>
    

flatpak

  • Upgrade installed packages
    flatpak update
    
  • Search a package
    flatpak search <search term>
    
  • Install a package
    flatpak install <package>
    # add --user to perform a user installation (no root permissions), by default --system
    
  • Remove a package
    flatpak uninstall <package>
    

snap

  • Upgrade installed packages
    snap refresh
    
  • Search a package
    snap find <search term>
    
  • Install a package
    snap install <package name>
    
  • Remove a package
    snap remove <package name>
    

npm (Node.js)

  • Search a package
    npm search <search term>
    
  • Install a package
    npm install <package>
    # add -g to install globally
    
  • Install all the dependencies on a project
    npm install
    
  • Remove a package
    npm uninstall <package>
    # add -g to uninstall a globally installed package
    
  • Info about a package
    npm view <package>
    

pip (Python)

  • Update a package
    pip install --upgrade <package>
    
  • Install a package
    pip install <package>
    
  • Remove a package
    pip uninstall <package>
    
  • Info about an installed package
    pip show <package>
    

If you have any suggestion, feel free to contact me via social media or email.