Basic Console Commands for Package Managers
RPM-based Linux Distributions
These include RedHat family members, such as CentOS, Fedora or Scientific Linux, and also openSUSE, also known as SUSE Linux. The package managers are yum
for CentOS and some others, dnf
a yum
fork used in recent Fedora distributions and zypper
a command line interface of ZYpp package management used in openSUSE project.
yum/dnf/rpm
yum repolist # list the configured repositories
yum clean all # clean local yum cache
yum makecache # download and refresh all the metadata
yum search SEARCH_STRING # search packages for the given string
yum search all SEARCH_STRING # same as above, but search all fields, such as description
yum deplist PACKAGE # list package dependencies
yum whatprovides SEARCH_STRING # list packages which provide given command or a file
yum install PACKAGE # install given package(s)
yum update PACKAGE # update given package(s)
yum list all # list all packages available
yum list installed # list all installed packages
rpm -ql PACKAGE # list files in a package
rpm -qlp PACKAGE_FILE # same as above, but for a package file
Repositories are managed via editing *.repo
files in the /etc/yum/repos.d/
directory or with yum-config-manager
command (run yum whatprovides yum-config-manager
to find out which package provides it).
zypper
zypper repos -u # list the configured repositories, their indexes and URLs
zypper refresh REPO_NAME # refresh repository information
zypper addrepo REPO_URL REPO_NAME # add a new repository
zypper namerepo REPO_INDEX REPO_NAME # rename given repository
zypper se SEARCH_STRING # search repositories for the given string
zypper se --provides --match-exact FILE # search packages for the given file
zypper se --requires PACKAGE # list all packages depended on the package
zypper in PACKAGE # install or updates a package
zypper update PACKAGE # update given package
zypper remove PACKAGE # remove given package
Debian-based Linux Distributions
Systems like Ubuntu, Linux Mint and others use .deb
as package format and APT, the Advanced Packaging Tool, for most operations. Recent releases include apt
command which is a unified interface for more traditional apt-get
and apt-cache
tools. All of them serve as a front-end to the dpkg
utility, which actually handles operations and in some cases can be invoked directly.
apt-get update # refresh package information
apt-cache search SEARCH_STRING # search repositories for the given string
apt-get install PACKAGE # install a package
apt-get upgrade PACKAGE # update a package
apt-get remove PACKAGE # remove a package
dpkg -i PACKAGE_FILE # install package from file
dpkg -l # list all installed packages
dpkg -L PACKAGE # list all files in the package