Using Linux command line is quicker for adding, removing, installing and updating software packages.
Various distros have their own package management tools, for e.g : Debian based distros use apt, Fedora/ Red Hat has dnf and openSUSE has zypper.
Let’s take a quick look at how to use zypper in openSUSE for updating, removing and finding various software packages. (Root privileges are needed for running most of these commands.)
If you are familiar with other Linux distros and have used apt and other such tools, using zypper will feel similar to those.
Here is a list of commonly used zypper commands for various package related tasks:
Installing system and security patches:
To apply various patches (both system and security related), open the Terminal in openSUSE and type in:
zypper patch-check
This will check for available patches but won’t apply them.
To get a list of available patches:
zypper list-patches
A list of all available patches will be displayed if any but won’t be applied.
Finally, to apply them if any, use the command :
zypper patch
The patches if any will now be downloaded and installed. This will apply necessary patches but not from any 3rd party repositories.
To install patches from 3rd party repositories, simply use the –with-update parameter:
zypper patch –with-update
Managing software packages:
Similar to checking patches, to see if any software updates for installed packages are available, type in :
zypper list-updates
To download and install the updates, use the following command:
zypper update
To know information about any package, the command is:
zypper info pkgname
This will display all the related information about the queried package.
To install a package:
zypper install pkgname
The package will then be installed with it’s dependencies.
You can also update an existing package individually:
zypper update pkgname
Also, you can search for a list of packages using wild cards. So for example, to search for a package which starts with initial letters ‘neof’ with the rest being any other letters, the command will be:
zypper search “neof*”
A list of all the packages matching the above wild card expression will be displayed. This is useful when you don’t know the exact package name.
You can also use the exact match when searching for packages by using the –match-exact parameter followed by package name:
zypper search –match-exact “pkgname”
Use the remove parameter to uninstall packages:
zypper remove pkgname
Also, to fix and dependencies errors and verify them, the command is:
zypper verify
Managing repositories:
To view all the available repositories in openSUSE :
zypper repos
To add a new 3rd party repository, use the ar parameter with -cf (check the repository path and auto refresh) followed by the path to that repository and the name:
zypper ar -cf repositoryURL reponame
To refresh all repsitories manually:
zypper refresh
Finally, use the help command to quickly find out various parameters that can be used with zypper:
zypper help
All done.