Zypper | Basic Reference

openSUSE uses Zypper as a package manager and although there is a great graphical tool for using Zypper, it is also fantastic in the terminal. This is by no means a complete list of how to use Zypper, just a very basic reference that covers the main bits that would be most often used.

For a more complete reference check the manual in terminal.

man zypper

Or go to the openSUSE wiki that provides a much more comprehensive usage guide.

https://en.opensuse.org/SDB:Zypper_manual

This is organized based on the task you are trying to perform. I use these all in the KDE Plasma Default terminal application, Konsole. Most of the zypper functions will require you to be in superuser (root user) mode. That is achieved by prepending the zypper command with sudo.

Update System Packages

Updates in Leap and Tumbleweed require different options.

Leap

sudo zypper update

Tumbleweed

sudo zypper dup

dup is short for distribution upgrade and this is a different process than the update command.

Refresh Repositories

sudo zypper ref

Use this to refresh the repository and ensure they are properly updated and After adding a new repository.

List Repositories

zypper ls

No sudo required

Add Repository

sudo zypper ar [some repository location] [name of repository]

Example:

sudo zypper ar http://download.opensuse.org/repositories/mozilla/openSUSE_Leap_15.1/ Mozilla

Remove Repository

sudo zypper rr [some repository]

Example:

sudo zypper rr Mozilla

Enable / Disable Repository

Enable

sudo zypper mr -d [some repository]

Disable

sudo zypper mr -e [some repository]

This is handy if you are testing different packages from different repositories.

Search for Package

No prependinig of sudo required

zypper se [some package]

Example:

zypper se falkon

To filter out only installed packages

zypper se -i [some package]

This could be used if you want to see what “python3” packages you have installed.

Install Package

sudo zypper in [some package]

Example:

sudo zypper in falkon

Bonus usage tip: You can force the reinstallation of a package by adding –force in front of the package name.

sudo zypper in --force falkon

Another Bonus tip: You can install packages using a wildcard but use this with caution as you can end up installing things unnecessarily.

sudo zypper in falkon*

Use this very carefully.

Remove Package

sudo zypper rm [some package]

Example

sudo zypper rm falkon

This will remove the falkon package and anything dependent on falkon.

Package Locking

There are times when you want to lock a package to prevent it from being automatically upgraded. In my case, there is a specific version of an application I prefer of an application and don’t want it updated.

Add Lock

sudo zypper al [some package]

List Locks

In case you are need to see what packages you have locked.

zypper ll

Remove Lock

In case you would like to remove those locks

sudo zypper rl [some package]

There are not many packages I need to lock, currently only one but it makes for less interaction when performing updates.

Extra Cool Stuff

This section, should perhaps be moved elsewhere in this quick reference but rather than think about it, I decided to just throw it in here.

Non interactive mode

--non-interactive

In this mode zypper does not prompt the user for any answers and uses default answers instead. When using this option it is guaranteed that zypper will not hang prompting for an answer.

For example, to update your system automatically without confirmation, you can type

zypper --non-interactive update

This command does not require confirmation from the user to proceed with update, skips all interactive patches which would need additional confirmation and also automatically answers any other prompts.

Final Thoughts

A lot of the documentation on how to use terminal applications, like Zypper can have a bit of a “barrier” to understand how to actually use it. It is not that the documentation is poorly written but rather written for a higher level of expertise. Some time ago, I had to break down the manual like this so that I could more easily reference and digest the information. This is nothing more than my own personal usage notes written for my inner 8th grader.

References

https://en.opensuse.org/SDB:Zypper_manual

https://en.opensuse.org/SDB:Zypper_usage