Zypper Package Manager Cheat Sheet

Zypper Cheat Sheet Featured

Zypper is the default package manager for openSUSE distributions and SUSE Linux Enterprise Servers. It differs from APT and YUM package managers, as it employs SAT solver, one of the best package dependency libraries. This Zypper cheat sheet covers the main zypper commands, segmented into various categories.

Basic Help

To get help with Zypper commands, use the following options:

CommandFunctionality
zypper #Show all available global commands and options
zypper help [command]Displays help for the specified command
zypper shell
or
zypper sh
Starts a shell session

Repository Management

Under repository management, Zypper has various commands. They include:

Add repositories/get information about repos

CommandFunctionality
zypper addrepo [repo url alias ]
or
zypper ar
Add a new repository with the specified repo URL
zypper info [package]
or
zypper if
Show information about a specified package

Rename repository aliases

CommandFunctionality
zypper namerepo
or
zypper nr
Used to rename a repository alias.
For example, to rename repo from “sample” to “sample.repo”:
zypper nr sample sample.repo

Modify repositories

CommandFunctionality
zypper modifyrepo
or
zypper mr
Modify a repo by either enabling or disabling it. Use the repository unique value from the zypper lr command.

Remove repositories

CommandFunctionality
zypper removerepo
or
zypper rr
Remove a specified repo. For example: zypper rr repo-non-oss

Refresh repositories

CommandFunctionality
zypper refresh [repo alias]
or
zypper ref
Refresh the specified repository. For example: zypper ref repo-oss

List defined repositories

CommandFunctionality
zypper repos
or
zypper lr
Show the available repositories, including alias and source URI

Clean repositories

CommandFunctionality
zypper clean
or
zypper cc
Clean a specified repository. For example: zypper cc repo-oss

Export/import repositories

CommandFunctionality
zypper repos -e [repo-name][destination]Export the specified repository from a set source to destination
zypper repos -ar [repo-name] [src]Import a repository from specified source

Service Management

Under service management, Zypper has the following options:

CommandFunction
zypper services
or
zypper ls
Show the repository’s defined services
zypper addservice ][service-name]
or
zypper as
Add a service with the specified name
zyppermodifyservice [service-name]
or
zypper ms
Modify the specified service
zypper refresh service
or
zypper refs
Refresh all the available services
zypper removeservice [service name]
or
zypper rs
Remove the specified service

Package Management

Under package management, zypper has the following command options:

Install packages

CommandFunctionality
zypper install [package]
or
zypper in
Install the latest version of the specified package

Remove packages

CommandFunctionality
zypper remove [package]
or
zypper rm
Remove the installed version of the specified package

Verify packages

CommandFunctionality
zypper verify
or
zypper ve
Verify the integrity of package dependencies. Useful when you have broken packages

Update packages

CommandFunctionality
zypper source-install
or
zypper si
Install source packages and build dependecies

NOTE: you can use the -D and -d global options to install the source package without the dependencies and install only the build dependencies, respectively.

CommandFunctionality
zypper install-new-recommeds
or
zypper inr
Install new recommended packages
zypper update
or
zypper up
Update the specified packages

Search packages

CommandFunctionality
zypper search [package-name]
or
zypper se
Search for a package. For example, zypper se nginx

Information about packages

CommandFunctionality
zypper info [package-name]Display detailed information about the specified package

Distribution Upgrade

CommandFunctionality
zypper dist-upgrade
or
zypper dup
Perform a distribution upgrade for all installed packages. It is best to restrict upgrade from a specific source repo

Conclusion

This succinct Zypper package manager cheat sheet has covered all the main commands you need to know to work effectively with Zypper. Read on to learn the history of Linux distros and how to choose a Linux distro without trying all of them.

Subscribe to our newsletter!

Our latest tutorials delivered straight to your inbox