
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:
Command | Functionality |
---|---|
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
Command | Functionality |
---|---|
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
Command | Functionality |
---|---|
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
Command | Functionality |
---|---|
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
Command | Functionality |
---|---|
zypper removerepo or zypper rr | Remove a specified repo. For example: zypper rr repo-non-oss |
Refresh repositories
Command | Functionality |
---|---|
zypper refresh [repo alias] or zypper ref | Refresh the specified repository. For example: zypper ref repo-oss |
List defined repositories
Command | Functionality |
---|---|
zypper repos or zypper lr | Show the available repositories, including alias and source URI |
Clean repositories
Command | Functionality |
---|---|
zypper clean or zypper cc | Clean a specified repository. For example: zypper cc repo-oss |
Export/import repositories
Command | Functionality |
---|---|
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:
Command | Function |
---|---|
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
Command | Functionality |
---|---|
zypper install [package] or zypper in | Install the latest version of the specified package |
Remove packages
Command | Functionality |
---|---|
zypper remove [package] or zypper rm | Remove the installed version of the specified package |
Verify packages
Command | Functionality |
---|---|
zypper verify or zypper ve | Verify the integrity of package dependencies. Useful when you have broken packages |
Update packages
Command | Functionality |
---|---|
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.
Command | Functionality |
---|---|
zypper install-new-recommeds or zypper inr | Install new recommended packages |
zypper update or zypper up | Update the specified packages |
Search packages
Command | Functionality |
---|---|
zypper search [package-name] or zypper se | Search for a package. For example, zypper se nginx |
Information about packages
Command | Functionality |
---|---|
zypper info [package-name] | Display detailed information about the specified package |
Distribution Upgrade
Command | Functionality |
---|---|
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.
Our latest tutorials delivered straight to your inbox