Using zypper, how can I remove all packages installed from a specific repository?
13,323
Solution 1
I think there is no such command. You can list packages from specific repository:
zypper search --installed-only --repo devel:tools
or all orphaned packages if you've already removed that repository:
zypper packages --orphaned
Then you could try to cut
package names from the output and pass it to zypper remove
if it's worth the effort.
Solution 2
You can use a combination of zypper search
, awk
and xargs
to remove all packages from a repository. For example:
zypper se --repo openSUSE-Tumbleweed-Debug --installed | awk '/^i(\+|\s)/ {print $3}' | xargs sudo zypper rm
Related videos on Youtube
Author by
Brandon
Updated on September 18, 2022Comments
-
Brandon over 1 year
Say I've added a repository using
zypper ar
. Then, I've gone and installed multiple packages from that repository, but now I want to remove all of them.Is there a command that allows me to remove all the packages that I've installed just from that specific repository?
-
Push almost 10 yearsMy openSuSE 12.3 system does not have the
--orphaned
option, but this might work:zypper packages -i -R
: it lists the installed package in Reverse order of repository. -
Mesco about 6 years
awk '/^i(\+|\s)/ {print $3}'
to match all installed packages (i or i+) -
sebix about 6 years@Mesco zypper itself should only print installed packages when using
--installed
. -
Mesco about 6 yearsright, using
-i
or--installed-only
. But also I've search for i and i+ at the beggining to skip first few rows (Loading repository data...
). Maybe there are better methods, to skip first 5 rows but if you already use regex... ;) -
Mesco about 6 yearsmaybe I'm using different zypper version (1.14.4) but its man says that the order should be
se [options] [query]
so your solution didn't work. -
sebix about 6 yearsAh, now I understand your concern. I updated the answer. About the search-syntax: I only use options and no query, so the order is correct I think.