Join my Laravel for REST API's course on Udemy 👀

Zypper cheat sheet

February 11, 2020  ‐ 3 min read

Zypper is the package manager of OpenSUSE and SUSE Linux. The basics are pretty easy to remember but sometimes a cheat sheet is just handy.

Package Management

zypper install (in)

Install a new package, if the specified package is already installed it will be updated.

$ zypper install php7

The same, but using the shorthand in notation.

$ zypper in php7

In case you need a specific version of a package you can add preferred version number right after the package name followed by an equal sign.

$ zypper in zypper=1.14.30

In OpenSUSE packages can be installed as pattern too. Patterns in OpenSUSE are basically a group of related packages that are required to run a specific piece of software. Like installing the desktop environment xfce for example, which requires other packages such as the X Window System.

Instead of installing these packages individually, all of these packages can all be easily installed as a pattern by the following command.

$ zypper in -t pattern xfce

zypper remove (rm)

Uninstall the specified package and their, possible, dependent packages.

$ zypper rm php7

The same, but using the shorthand rm notation.

$ zypper rm php7

zypper info (if)

Displays detailed information about the specified packages.

$ zypper if php7

Show symbols the package requires.

$ zypper if --requires php7

zypper verify (ve)

Check whether the dependencies of installed packages on your system are satisfied and possibly installing missing dependencies.

$ zypper ve

Update Management

zypper update (up)

Update installed packages with newer versions.

$ zypper up

Update a specific package with a newer version.

$ zypper up php7

zypper list-updates (lu)

List installable updates.

$ zypper lu

zypper dist-upgrade (dup)

Perform a distribution upgrade.

$ zypper dup

Query Commands

zypper search (se)

Search for packages matching any of the given search strings.

$ zypper se mysql

Search using a wildcard.

$ zypper se 'yast*'

Search for packages that provide a specific binary.

$ zypper se --provides --match-exact npm

zypper packages (pa)

Show packages which are orphaned (without repository).

$ zypper pa --orphaned

Show packages which are unneeded.

$ zypper pa --unneeded

zypper patterns (pt)

List all available patterns or all patterns from specified repositories.

$ zypper pt

Repository Management

zypper addrepo (ar)

Add a new repository specified.

$ zypper ar

zypper removerepo (rr)

Delete repositories specified.

$ zypper rr

zypper repos (lr)

List all defined repositories.

$ zypper lr

zypper refresh (ref)

Refresh repositories specified by their alias, name, number, or URI.

$ zypper ref

zypper clean (cc)

Clean the local caches for all known or specified repositories.

$ zypper cc

Package Locks

zypper locks (ll)

List currently active package locks.

$ zypper ll

zypper addlock (al)

Add a package lock.

$ zypper al php7

zypper removelock (rl)

Remove specified package lock.

$ zypper rm php7