Came here looking to answer the same question as OP, but saw a few posters having trouble…
Indeed
zypper rm -u
does not work, too few arguments for rm.
Trying to run
zypper rm -u *
will give precedence to the * over the -u, so you are specifying to remove everything plus all of everything’s dependencies (redundant). As people have mentioned, you probably don’t want to do this.
What you see from
zypper pa --unneeded
are packages that were installed as dependencies, then the package that depended on them was removed.
Both zypper and YaST can tell the difference between a package that was manually selected for installation, and one that was pulled in as a dependency. If you try to manually install a package that already was installed as a dependency, it just gets its flag changed from dependency to manually installed.
Unfortunately, I can’t figure out a way to perform the equivalent of “apt-get autoremove” in a terminal, but I suspect some bash wizard may be able to figure out how to pipe the output of
zypper pa --unneeded
to the argument for
zypper rm
. In the meantime, the guy who mentioned that YaST can display “Unneeded packages” gives us an easy way to mass select and perform the equivalent of “autoremove”.
I really wouldn’t use or trust the unneeded packages tab in yast as there currently is a bug in it, a lot of imo needed packages are shown as unneeded (this bug didn’t exist in 42.2 or 13.x as I only got one or two old applications in that list) https://imgur.com/a/J4gjw
:~> zypper packages --unneeded
Loading repository data...
Reading installed packages...
S | Repository | Name | Version | Arch
--+----------------------------+---------------------------------------+-----------------+-------
i | openSUSE-Leap-42.3-Non-Oss | AdobeICCProfiles | 2.0-138.8 | noarch
i | openSUSE-42.3-0 | baloo5-file | 5.32.0-1.3 | x86_64
i | openSUSE-42.3-0 | baloo5-tools | 5.32.0-1.3 | x86_64
i | openSUSE-42.3-0 | cdrdao | 1.2.3-16.1 | x86_64
i | openSUSE-42.3-0 | cdrecord | 3.02~a07-1.2 | x86_64
i | openSUSE-42.3-0 | digikam-doc | 5.5.0-2.11 | noarch
i | openSUSE-42.3-0 | exiftool | 10.55-1.1 | noarch
i | openSUSE-Leap-42.3-Update | exiv2 | 0.25-10.1 | x86_64
i | openSUSE-42.3-0 | ffmpegthumbs | 17.04.2-1.1 | x86_64
i | openSUSE-Leap-42.3-Update | gdb | 8.0.1-3.1 | x86_64
i | openSUSE-42.3-0 | gpgmepp5 | 16.08.2-3.7 | x86_64
i | openSUSE-42.3-0 | htdig | 3.2.0b6-242.1 | x86_64
i | openSUSE-42.3-0 | incidenceeditor | 17.04.2-1.1 | x86_64
i | openSUSE-42.3-0 | kalarmcal | 17.04.2-1.1 | x86_64
i | openSUSE-42.3-0 | kcolorchooser | 17.04.2-1.1 | x86_64
i | openSUSE-42.3-0 | kdav | 17.04.2-1.1 | x86_64
i | openSUSE-42.3-0 | kde-gtk-config5 | 5.8.7-1.1 | x86_64
i | openSUSE-42.3-0 | kde-odf-thumbnail | 1.0.0-3.2 | x86_64
i | openSUSE-42.3-0 | kde-oxygen-fonts | 0.4.0-6.18 | noarch
i | openSUSE-42.3-0 | kdebase4-workspace-libs | 4.11.22-5.29 | x86_64
i | openSUSE-42.3-0 | keditbookmarks | 17.04.2-1.1 | x86_64
i | openSUSE-42.3-0 | kgamma5 | 5.8.7-1.1 | x86_64
i | openSUSE-42.3-0 | kio_kamera | 17.04.2-1.6 | x86_64
i | openSUSE-42.3-0 | kio_mtp | 0.75-8.1 | x86_64
i | openSUSE-42.3-0 | kipi-plugins | 5.5.0-2.11 | x86_64
i | openSUSE-Leap-42.3-Update | kmail-application-icons | 17.04.2-3.1 | x86_64
i | openSUSE-42.3-0 | konqueror-plugins | 17.04.2-2.1 | x86_64
i | openSUSE-42.3-0 | kwalletmanager5 | 17.04.2-1.6 | x86_64
i | openSUSE-42.3-0 | libKF5AkonadiAgentBase5 | 17.04.2-1.6 | x86_64
i | openSUSE-42.3-0 | libKF5AkonadiWidgets5 | 17.04.2-1.6 | x86_64
i | openSUSE-42.3-0 | libKF5AkonadiXml5 | 17.04.2-1.6 | x86_64
i | openSUSE-42.3-0 | libKF5Contacts5 | 17.04.2-1.1 | x86_64
i | openSUSE-42.3-0 | libKGantt2 | 2.6.0-1.1 | x86_64
i | openSUSE-42.3-0 | libSDL_ttf-2_0-0 | 2.0.11-12.3 | x86_64
i | openSUSE-Leap-42.3-Update | libetpan17 | 1.6-8.1 | x86_64
i | openSUSE-42.3-0 | libgltf-0_0-0 | 0.0.1-5.1 | x86_64
i | openSUSE-Leap-42.3-Update | libjpeg-turbo | 1.5.3-42.1 | x86_64
i | openSUSE-42.3-0 | libkleo | 17.04.2-1.1 | x86_64
i | openSUSE-42.3-0 | libkolabxml1 | 1.1.2-13.26 | x86_64
i | openSUSE-42.3-0 | libkscreen1 | 1.0.5-6.1 | x86_64
i | openSUSE-42.3-0 | liblqr-1-0 | 0.4.2-8.3 | x86_64
i | openSUSE-42.3-0 | libmbim | 1.14.0-3.4 | x86_64
i | openSUSE-42.3-0 | libmeanwhile1 | 1.0.2-139.1 | x86_64
i | openSUSE-42.3-0 | libmusicbrainz4 | 2.1.5-32.4 | x86_64
i | openSUSE-42.3-0 | libnm-glib-vpn1 | 1.0.12-6.5 | x86_64
i | openSUSE-42.3-0 | libnm-gtk0 | 1.0.10-13.2 | x86_64
i | openSUSE-42.3-0 | libopencv-qt56_3 | 3.1.0-3.26 | x86_64
i | openSUSE-42.3-0 | libotr5 | 4.1.1-6.5 | x86_64
i | openSUSE-42.3-0 | libpano13-3 | 2.9.19-6.1 | x86_64
i | openSUSE-42.3-0 | libpisock9 | 0.12.5-30.13 | x86_64
i | openSUSE-42.3-0 | libqgpgme7 | 1.9.0-1.3 | x86_64
i | openSUSE-42.3-0 | libqimageblitz4 | 0.0.6-16.6 | x86_64
i | openSUSE-Leap-42.3-Update | libqt5-qtwebengine | 5.6.2-6.2 | x86_64
i | openSUSE-42.3-0 | libvncclient0 | 0.9.9-15.4 | x86_64
i | openSUSE-42.3-0 | libwebkitgtk-1_0-0 | 2.4.11-4.26 | x86_64
i | openSUSE-42.3-0 | libwx_baseu-2_8-0-compat-lib-stl | 2.8.12-32.27 | x86_64
i | openSUSE-Leap-42.3-Update | libwx_baseu_net-suse1 | 3.0.2-11.1 | x86_64
i | openSUSE-Leap-42.3-Update | libwx_gtk2u_aui-suse1 | 3.0.2-11.1 | x86_64
i | openSUSE-42.3-0 | libwx_gtk2u_core-2_8-0-compat-lib-stl | 2.8.12-32.27 | x86_64
i | openSUSE-Leap-42.3-Update | libwx_gtk2u_gl-suse1 | 3.0.2-11.1 | x86_64
i | openSUSE-42.3-0 | libwx_gtk2u_html-2_8-0-compat-lib-stl | 2.8.12-32.27 | x86_64
i | openSUSE-Leap-42.3-Update | libwx_gtk2u_qa-suse1 | 3.0.2-11.1 | x86_64
i | openSUSE-Leap-42.3-Update | libwx_gtk2u_xrc-suse1 | 3.0.2-11.1 | x86_64
i | @System | libx265-130 | 2.5-1.1 | x86_64
i | openSUSE-Leap-42.3-Update | mariadb | 10.0.33-29.1 | x86_64
i | openSUSE-Leap-42.3-Update | openvpn | 2.3.8-14.1 | x86_64
i | openSUSE-42.3-0 | pinentry-gtk2 | 0.8.3-6.4 | x86_64
i | openSUSE-42.3-0 | pinentry-qt4 | 0.8.3-6.4 | x86_64
i | openSUSE-Leap-42.3-Update | pulseaudio-module-jack | 9.0-5.1 | x86_64
i | openSUSE-42.3-0 | python-gnome | 2.28.1-28.3 | x86_64
i | openSUSE-42.3-0 | susehelp | 2009.10.06-25.1 | noarch
i | openSUSE-42.3-0 | susehelp_en | 2009.10.06-25.1 | noarch
i | openSUSE-42.3-0 | telepathy-accounts-signon | 1.0-4.1 | x86_64
i | openSUSE-42.3-0 | ubuntu-fonts | 0.80-8.1 | noarch
i | openSUSE-42.3-0 | vcdimager | 0.7.24cvs-16.3 | x86_64
i | openSUSE-42.3-0 | vpnc | 0.5.3r550-5.3 | x86_64
i | openSUSE-42.3-0 | xdg-user-dirs | 0.15-8.1 | x86_64
i | openSUSE-42.3-0 | xf86-video-nv | 2.1.20-16.1 | x86_64
I just took the screenshot above on a fully updated LEAP 42.3 so no don’t remove packages you’re unsure about although some of the shown packages I’ve never used like cdrecord libjpeg-turbo is a system package and is needed
as I don’t use TW I can’t be 100% sure but afaik there is no working way to remove “unneeded packages” on opensuse
This is a massively dangerous thread to have lying around! Sure I’m not the only one to skim over the first page looking for a command and there are some there - which, on page 2, are pointed out to be really bad news for your system.
Maybe a warning could be pinned to the top. You’ll be glad to hear that I didn’t use any of them though