Deleted most of the packages using apt-get purge package\*; How can I get them back? [duplicate]

Solution 1:

Here's the list of deleted packages (at least on Debian):

➜  ~  apt-get -s purge wine\*
NOTE: This is only a simulation!
      apt-get needs root privileges for real execution.
      Keep also in mind that locking is deactivated,
      so don't depend on the relevance to the real current situation!
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Note, selecting 'kmfl-keyboards-mywin' for regex 'wine*'
Note, selecting 'kwin-style-qtcurve' for regex 'wine*'
Note, selecting 'windows-el' for regex 'wine*'
Note, selecting 'avifile-win32-plugin' for regex 'wine*'
Note, selecting 'libunwind8' for regex 'wine*'
Note, selecting 'navit-graphics-gtk-drawing-area' for regex 'wine*'
Note, selecting 'golang-go-darwin-amd64' for regex 'wine*'
Note, selecting 'hwinfo' for regex 'wine*'
Note, selecting 'libchewing2-dev' for regex 'wine*'
Note, selecting 'winff-gtk2' for regex 'wine*'
Note, selecting 'wine64-unstable' for regex 'wine*'
Note, selecting 'wine64-bin' for regex 'wine*'
Note, selecting 'winff-qt' for regex 'wine*'
Note, selecting 'scim-chewing' for regex 'wine*'
Note, selecting 'openwince-jtag' for regex 'wine*'
Note, selecting 'gpgv-win32' for regex 'wine*'
Note, selecting 'libwine-openal' for regex 'wine*'
Note, selecting 'gemrb-icewind-dale-data' for regex 'wine*'
Note, selecting 'wine32-dev-tools' for regex 'wine*'
Note, selecting 'petitboot-twin' for regex 'wine*'
Note, selecting 'libswing-layout-java' for regex 'wine*'
Note, selecting 'libswing-layout-java-doc' for regex 'wine*'
Note, selecting 'gemrb-icewind-dale-2' for regex 'wine*'
Note, selecting 'libwine-dev' for regex 'wine*'
Note, selecting 'plplot12-driver-xwin' for regex 'wine*'
Note, selecting 'libswingx-java' for regex 'wine*'
Note, selecting 'libfreehep-swing-java' for regex 'wine*'
Note, selecting 'libchewing3-dbg' for regex 'wine*'
Note, selecting 'kdeartwork-theme-window' for regex 'wine*'
Note, selecting 'libx11-windowhierarchy-perl' for regex 'wine*'
Note, selecting 'libwine-gecko-dbg-2.21' for regex 'wine*'
Note, selecting 'golang-go-windows-amd64' for regex 'wine*'
Note, selecting 'libwine-capi' for regex 'wine*'
Note, selecting 'winbind' for regex 'wine*'
Note, selecting 'libtwin0' for regex 'wine*'
Note, selecting 'wine-utils' for regex 'wine*'
Note, selecting 'winff-doc' for regex 'wine*'
Note, selecting 'q4wine-unstable' for regex 'wine*'
Note, selecting 'win32-loader' for regex 'wine*'
Note, selecting 'wine64-development-preloader' for regex 'wine*'
Note, selecting 'cpio-win32' for regex 'wine*'
Note, selecting 'libchewing' for regex 'wine*'
Note, selecting 'wine64-development' for regex 'wine*'
Note, selecting 'wininfo' for regex 'wine*'
Note, selecting 'libkwineffects1abi5' for regex 'wine*'
Note, selecting 'freepwing' for regex 'wine*'
Note, selecting 'libchewing3-dev' for regex 'wine*'
Note, selecting 'libwine-ldap' for regex 'wine*'
Note, selecting 'libwine-oss' for regex 'wine*'
Note, selecting 'winpdb' for regex 'wine*'
Note, selecting 'libkwinglesutils1' for regex 'wine*'
Note, selecting 'libwind0-heimdal' for regex 'wine*'
Note, selecting 'libwine-gphoto2' for regex 'wine*'
Note, selecting 'libwine-sane' for regex 'wine*'
Note, selecting 'phylowin' for regex 'wine*'
Note, selecting 'qml-module-qtquick-window2' for regex 'wine*'
Note, selecting 'libwine-alsa' for regex 'wine*'
Note, selecting 'matchbox-window-manager' for regex 'wine*'
Note, selecting 'windowlab' for regex 'wine*'
Note, selecting 'wine64-bin-unstable' for regex 'wine*'
Note, selecting 'libworldwind-java' for regex 'wine*'
Note, selecting 'ibus-chewing' for regex 'wine*'
Note, selecting 'libwings-dev' for regex 'wine*'
Note, selecting 'winswitch' for regex 'wine*'
Note, selecting 'libwin-hivex-perl' for regex 'wine*'
Note, selecting 'wine' for regex 'wine*'
Note, selecting 'wing' for regex 'wine*'
Note, selecting 'wink' for regex 'wine*'
Note, selecting 'worldwind' for regex 'wine*'
Note, selecting 'libmono-system-windows-forms-datavisualization4.0a-cil' for regex 'wine*'
Note, selecting 'q4wine' for regex 'wine*'
Note, selecting 'winetricks' for regex 'wine*'
Note, selecting 'winkeydaemon' for regex 'wine*'
Note, selecting 'wine32-unstable' for regex 'wine*'
Note, selecting 'wine64-development-tools' for regex 'wine*'
Note, selecting 'libwine-development-dbg' for regex 'wine*'
Note, selecting 'mate-window-manager' for regex 'wine*'
Note, selecting 'libtwin-dev' for regex 'wine*'
Note, selecting 'shiki-wine-theme' for regex 'wine*'
Note, selecting 'wine32' for regex 'wine*'
Note, selecting 'libcsfml-window2' for regex 'wine*'
Note, selecting 'libkwinglutils1abi2' for regex 'wine*'
Note, selecting 'libmate-window-settings-dbg' for regex 'wine*'
Note, selecting 'libunwind-setjmp0-dbg' for regex 'wine*'
Note, selecting 'wings3d' for regex 'wine*'
Note, selecting 'libnss-winbind' for regex 'wine*'
Note, selecting 'libmate-window-settings1' for regex 'wine*'
Note, selecting 'kde-window-manager' for regex 'wine*'
Note, selecting 'libunwind1-dev' for regex 'wine*'
Note, selecting 'libmono-system-drawing4.0-cil' for regex 'wine*'
Note, selecting 'libswingx1-java-doc' for regex 'wine*'
Note, selecting 'libunwind7-dev' for regex 'wine*'
Note, selecting 'libwine-development-dev' for regex 'wine*'
Note, selecting 'wine-development' for regex 'wine*'
Note, selecting 'libparse-win32registry-perl' for regex 'wine*'
Note, selecting 'libswingx1-java' for regex 'wine*'
Note, selecting 'wine64' for regex 'wine*'
Note, selecting 'libwine-cms' for regex 'wine*'
Note, selecting 'libwine' for regex 'wine*'
Note, selecting 'science-viewing-dev' for regex 'wine*'
Note, selecting 'libmate-window-settings-dev' for regex 'wine*'
Note, selecting 'avant-window-navigator' for regex 'wine*'
Note, selecting 'libmono-system-reactive-windows-threading2.1-cil' for regex 'wine*'
Note, selecting 'libmono-system-drawing-design4.0-cil' for regex 'wine*'
Note, selecting 'libsfml-window2' for regex 'wine*'
Note, selecting 'libunwind-setjmp0-dev' for regex 'wine*'
Note, selecting 'ibus-chewing-dbg' for regex 'wine*'
Note, selecting 'openwince-include' for regex 'wine*'
Note, selecting 'qtdeclarative5-window-plugin' for regex 'wine*'
Note, selecting 'fcitx-chewing' for regex 'wine*'
Note, selecting 'gemrb-icewind-dale-2-data' for regex 'wine*'
Note, selecting 'libunwind8-dbg' for regex 'wine*'
Note, selecting 'libchewing-dev' for regex 'wine*'
Note, selecting 'kwin-style-dekorator' for regex 'wine*'
Note, selecting 'libchewing-data' for regex 'wine*'
Note, selecting 'libwine-bin' for regex 'wine*'
Note, selecting 'libwine-development' for regex 'wine*'
Note, selecting 'libapache2-mod-auth-ntlm-winbind' for regex 'wine*'
Note, selecting 'wine32-development' for regex 'wine*'
Note, selecting 'golang-go-windows-386' for regex 'wine*'
Note, selecting 'libmono-system-reactive-windows-forms2.1-cil' for regex 'wine*'
Note, selecting 'libwings2' for regex 'wine*'
Note, selecting 'libwine-gl' for regex 'wine*'
Note, selecting 'wine1.2' for regex 'wine*'
Note, selecting 'wine1.3' for regex 'wine*'
Note, selecting 'wine-unstable' for regex 'wine*'
Note, selecting 'wine1.4' for regex 'wine*'
Note, selecting 'wine1.5' for regex 'wine*'
Note, selecting 'x-window-system-core' for regex 'wine*'
Note, selecting 'libchewing3-data' for regex 'wine*'
Note, selecting 'libunwind8-dev' for regex 'wine*'
Note, selecting 'libmono-windowsbase3.0-cil' for regex 'wine*'
Note, selecting 'kwin-style-oxygen-transparent' for regex 'wine*'
Note, selecting 'winwrangler' for regex 'wine*'
Note, selecting 'plplot11-driver-xwin' for regex 'wine*'
Note, selecting 'libmono-system-windows-forms4.0-cil' for regex 'wine*'
Note, selecting 'libmono-system-reactive-windows-threading2.2-cil' for regex 'wine*'
Note, selecting 'wine-doc' for regex 'wine*'
Note, selecting 'golang-go-darwin-386' for regex 'wine*'
Note, selecting 'wing-data' for regex 'wine*'
Note, selecting 'libmono-winforms2.0-cil' for regex 'wine*'
Note, selecting 'arc-wine' for regex 'wine*'
Note, selecting 'x-window-manager' for regex 'wine*'
Note, selecting 'libjenkins-winstone-java-doc' for regex 'wine*'
Note, selecting 'fte-xwindow' for regex 'wine*'
Note, selecting 'libmono-system-windows-forms-datavisualization4.0-cil' for regex 'wine*'
Note, selecting 'wine32-development-tools' for regex 'wine*'
Note, selecting 'hime-chewing' for regex 'wine*'
Note, selecting 'gzip-win32' for regex 'wine*'
Note, selecting 'libjenkins-winstone-java' for regex 'wine*'
Note, selecting 'pd-windowing' for regex 'wine*'
Note, selecting 'libmono-windowsbase4.0-cil' for regex 'wine*'
Note, selecting 'libmate-window-settings1-dbg' for regex 'wine*'
Note, selecting 'libswingx-java-doc' for regex 'wine*'
Note, selecting 'libmono-system-reactive-windows-forms2.2-cil' for regex 'wine*'
Note, selecting 'wine64-dev-tools' for regex 'wine*'
Note, selecting 'libpam-winbind' for regex 'wine*'
Note, selecting 'kwin4-style-bespin' for regex 'wine*'
Note, selecting 'ucimf-chewing' for regex 'wine*'
Note, selecting 'kwin-style-crystal' for regex 'wine*'
Note, selecting 'gextractwinicons' for regex 'wine*'
Note, selecting 'uim-chewing' for regex 'wine*'
Note, selecting 'twinkle' for regex 'wine*'
Note, selecting 'emacs-window-layout' for regex 'wine*'
Note, selecting 'libchewing3' for regex 'wine*'
Note, selecting 'gemrb-icewind-dale' for regex 'wine*'
Note, selecting 'gnome-wine-icon-theme' for regex 'wine*'
Note, selecting 'x-window-system' for regex 'wine*'
Note, selecting 'libchewing1-dev' for regex 'wine*'
Note, selecting 'winbind4' for regex 'wine*'
Note, selecting 'science-viewing' for regex 'wine*'
Note, selecting 'libjswingreader-java' for regex 'wine*'
Note, selecting 'plplot9-driver-xwin' for regex 'wine*'
Note, selecting 'libmono-system-windows4.0-cil' for regex 'wine*'
Note, selecting 'twine' for regex 'wine*'
Note, selecting 'libunwind-setjmp0' for regex 'wine*'
Note, selecting 'winbindd' for regex 'wine*'
Note, selecting 'winff' for regex 'wine*'
Note, selecting 'python-strongwind' for regex 'wine*'
Note, selecting 'winff-dbg' for regex 'wine*'
Note, selecting 'libwine-gecko-2.21' for regex 'wine*'
Note, selecting 'all-knowing-dns' for regex 'wine*'
Note, selecting 'wine-bin' for regex 'wine*'

And these were the actual packages removed:

The following packages will be REMOVED:
  gnome-control-center* gvfs-backends* keepass2* libglade2.0-cil*
  libgssapi3-heimdal* libgtk2.0-cil* libhdb9-heimdal* libheimntlm0-heimdal*
  libhx509-5-heimdal* libkdc2-heimdal* libkrb5-26-heimdal*
  libmate-window-settings1* libmono-cil-dev* libmono-http4.0-cil*
  libmono-microsoft-web-infrastructure1.0-cil*
  libmono-system-data-services2.0-cil* libmono-system-data-services4.0-cil*
  libmono-system-design4.0-cil* libmono-system-drawing-design4.0-cil*
  libmono-system-drawing4.0-cil* libmono-system-messaging4.0-cil*
  libmono-system-reactive-windows-forms2.2-cil*
  libmono-system-reactive-windows-threading2.2-cil*
  libmono-system-runtime4.0-cil*
  libmono-system-servicemodel-activation4.0-cil*
  libmono-system-servicemodel-discovery4.0-cil*
  libmono-system-servicemodel-routing4.0-cil*
  libmono-system-servicemodel-web4.0-cil* libmono-system-servicemodel4.0a-cil*
  libmono-system-serviceprocess4.0-cil*
  libmono-system-web-abstractions4.0-cil*
  libmono-system-web-dynamicdata4.0-cil*
  libmono-system-web-extensions-design4.0-cil*
  libmono-system-web-extensions4.0-cil*
  libmono-system-web-http-selfhost4.0-cil*
  libmono-system-web-http-webhost4.0-cil* libmono-system-web-mvc3.0-cil*
  libmono-system-web-routing4.0-cil* libmono-system-web-services4.0-cil*
  libmono-system-web-webpages-deployment2.0-cil*
  libmono-system-web-webpages-razor2.0-cil*
  libmono-system-web-webpages2.0-cil* libmono-system-web4.0-cil*
  libmono-system-windows-forms-datavisualization4.0a-cil*
  libmono-system-windows-forms4.0-cil* libmono-system-windows4.0-cil*
  libmono-system-xml-serialization4.0-cil* libmono-web4.0-cil*
  libmono-windowsbase3.0-cil* libmono-windowsbase4.0-cil*
  libmono-winforms2.0-cil* libnunit-cil-dev* libnunit2.6-cil* libsmbclient*
  libsmbclient-dev* libwebkit1.1-cil* libwind0-heimdal* libwine*
  libwine-gecko-2.21* mate-control-center* mate-desktop-environment-core*
  mono-4.0-service* mono-complete* mono-devel* monodoc-browser*
  monodoc-manual* mplayer* mpv* python-samba* samba* samba-common-bin*
  samba-dsdb-modules* samba-libs* samba-vfs-modules* wine* wine64*

The most scary package that was removed was x-window-manager, yet nothing of the sort was removed. What I can say is that unless you use KDE or MATE, there isn't any package that its removal would cause your system packages to be deleted, or leave you with a crippled system, in fact, if any really important package that would leave your system in an unbootable state you should see a warning like this one:

WARNING: The following essential packages will be removed.
This should NOT be done unless you know exactly what you are doing!
  apt

In which case it would ask you to type the complete phrase "I know what I'm doing! ", literally. So, since we know which packages were removed, we can know what functionality we lost... in fact none! We still have network-manager and apt/dpkg so fixing/reverting this would be a breeze, just moving to a TTY (Ctrl + Alt + F1) and installing the (k|l|x)ubuntu-desktop meta package should be enough to return everything to normal.

sudo apt-get install ubuntu-desktop

From there on, check what other package you installed isn't installed anymore.

Ah, final counsel, unless you know what the regex will do, don't do it. It was matching any package that had win or wine in its name. And as always -s/--simulate is your friend.