Zypper is the default package manager for openSUSE distributions and SUSE Linux Enterprise Servers. It differs from APT and DNF 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.
Download this Cheatsheet
Enter your email below to receive this PDF cheatsheet in your Inbox.
Command | Function |
---|---|
Basic Help | |
zypper # | Show all available global commands and options. |
zypper help [command] | Displays help for the specified command. |
zypper shell | Starts a shell session. |
Repository Management | |
zypper addrepo [repo url alias] | Add a new repository with the specified repo URL. |
zypper info [package] | Show information about a specified package. |
zypper namerepo | Used to rename a repository alias. For example, to rename repo from “sample” to “sample.repo”:zypper namerepo sample sample.repo . |
zypper modifyrepo | Modify a repo by either enabling or disabling it. Use the repository unique value from the zypper lr command. |
zypper removerepo | Remove a specified repo. For example: zypper removerepo repo-non-oss . |
zypper refresh [repo alias] | Refresh the specified repository. For example: zypper refresh repo-oss . |
zypper refresh [repo alias] | Refresh the specified repository. For example: zypper refresh repo-oss . |
zypper repos | Show the available repositories, including alias and source URI. |
zypper clean | Clean a specified repository. For example: zypper clean repo-oss . |
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 | |
zypper services | Show the repository’s defined services. |
zypper addservice [service-name] | Add a service with the specified name. |
zypper modifyservice [service-name] | Modify the specified service. |
zypper refresh service | Refresh all the available services. |
zypper removeservice [service name] | Remove the specified service. |
Package Installation | |
zypper install [package] | Install the latest version of the specified package. |
zypper install -D [package] | Simulate the installation of the specific package. |
zypper install -r [repo] [package] | Install the latest version of the specified package from a custom repository. |
zypper install -l [package] | Automatically agree to all non-free licenses when installing a specific package. |
zypper install –no-recommends [package] | Install the latest version of the specified package but do not install any optional packages. |
zypper install-new-recommends [package] | Install the latest version of any optional packages for the specified package. |
zypper install –oldpackage [package] | Install an older version of the specified package. |
Package Removal | |
zypper remove [package] | Remove the installed version of the specified package. |
zypper remove -D [package] | Simulate the removal of a specific package. |
zypper remove -u [package] | Remove the installed version of the specified package as well as any unused dependencies. |
zypper remove -U [package] | Remove the installed version of the specified package but do not remove any unused dependencies. |
zypper remove -C [feature] | Remove any packages that provide a particular system feature. |
zypper remove -n [package] | Remove any packages if it matches the current query. |
Package Verification | |
zypper verify | Verify the integrity of package dependencies. Useful when you have broken packages. |
zypper verify –no-recommends | Verify the integrity of package dependencies but do not modify and install any additional packages in the system. |
Source Package Management | |
zypper source-install | Install source packages and build dependencies. |
zypper source-install -D | Install the source packages without any build dependencies. |
zypper source-install -d | Install the build dependencies for a particular source package. |
zypper source-install –download-only | Download both the source file and its dependencies to your machine. |
Package Updates | |
zypper update | Update the specified packages. |
zypper update -l | Automatically agree to all non-free software licenses while updating the system. |
zypper update -r [repo] | Update the current system using packages from a custom repository. |
zypper update –skip-interactive | Update the current system and omit any package update that requires any user intervention. |
zypper update –with-interactive | Update the current system and forcefully update any packages that require user intervention. |
zypper update –replacefiles | Update the current system and skip potential file conflicts by allowing Zypper to overwrite existing packages. |
zypper update -D | Simulate a full system update. |
Package Patching | |
zypper list-patches | List all the available patches for all the currently installed packages. |
zypper list-patches -b | List all the available Bugzilla patches for all currently installed packages. |
zypper list-patches –cve | List all the available MITRE’s CVE patches for all currently installed packages. |
zypper patch-check | List all the applicable patches for the system. |
zypper patch | Install all the applicable patches for the system. |
zypper patch -b [patch number] | Install a specific Bugzilla patch for the system. |
zypper patch –cve [patch number] | Install a specific MITRE’s CVE patch for the system. |
Package Information and Search | |
zypper search [package-name] | Search for a package. For example, zypper se nginx . |
zypper search –match-exact [package name] | Do an exact word search on the current query. |
zypper search –requires [package name] | Search for all the packages that requires the current query as part of their dependency list. |
zypper search –recommends [package name] | Search for all the packages that the current query includes as its optional dependencies. |
zypper search –conflicts [package name] | Search for all the packages that conflicts with the current query. |
zypper info [package-name] | Display detailed information about the specified package. |
Distribution Upgrade | |
zypper dist-upgrade | Perform a distribution upgrade for all installed packages. It is best to restrict upgrade from a specific source repo. |
zypper dist-upgrade -D | Simulate a distribution upgrade for all installed packages. |
Image credit: Unsplash (Background) and Wikimedia Commons (Logo). All alterations by Ramces Red.
Is this post useful?
Subscribe to our newsletter!
Our latest tutorials delivered straight to your inbox