How to remove desktop environments?

To remove Fluxbox

Just press Ctrl+Alt+T on your keyboard to open Terminal. When it opens, run the commands below.

apt-get --purge remove xfree86-common
apt-get --purge remove fluxbox
apt-get --purge remove xfs
apt-get --purge remove xlibs-data
apt-get --purge remove xdialog

Source: damnsmalllinux

To remove OpenBox

Just press Ctrl+Alt+T on your keyboard to open Terminal. When it opens, run the commands below.

sudo apt-get purge openbox obconf obmenu

To remove XFCE Under Ubuntu 12.10

Just press Ctrl+Alt+T on your keyboard to open Terminal. When it opens, run the commands below.

 sudo apt-get remove abiword abiword-common abiword-plugin-grammar abiword-plugin-mathview alacarte bison blueman brltty-x11 catfish espeak exo-utils flex fonts-droid fonts-lyx gigolo gmusicbrowser gnome-system-tools gnome-time-admin gstreamer0.10-gnomevfs gthumb gthumb-data gtk2-engines-pixbuf indicator-application-gtk2 indicator-sound-gtk2 leafpad libabiword-2.9 libbison-dev libdigest-crc-perl libexo-1-0 libexo-common libexo-helpers libfl-dev libgarcon-1-0 libgarcon-common libgdome2-0 libgdome2-cpp-smart0c2a libglade2-0 libgnomevfs2-0 libgnomevfs2-common libgnomevfs2-extra libgsf-1-114 libgsf-1-common libgstreamer-perl libgtk2-notify-perl libgtk2-trayicon-perl libgtkmathview0c2a libgtkspell0 libido-0.1-0 libindicate-gtk3 libintl-perl libjpeg-progs libjpeg-turbo-progs libkeybinder0 liblink-grammar4 libloudmouth1-0 libnet-dbus-perl liboobs-1-5 libotr2 libots0 librarian0 libsexy2 libtagc0 libthunarx-2-0 libtidy-0.99-0 libtie-ixhash-perl libtumbler-1-0 libunique-1.0-0 libvte-common libvte9 libwv-1.2-4 libxfce4ui-1-0 libxfce4ui-utils libxfce4util-bin libxfce4util-common libxfce4util6 libxfcegui4-4 libxfconf-0-2 libxml-parser-perl libxml-twig-perl libxml-xpath-perl lightdm-gtk-greeter link-grammar-dictionaries-en m4 orage parole pastebinit pavucontrol pidgin pidgin-data pidgin-libnotify pidgin-microblog pidgin-otr plymouth-theme-xubuntu-logo plymouth-theme-xubuntu-text python-configobj rarian-compat ristretto screensaver-default-images scrollkeeper shimmer-themes system-tools-backends tcl8.5 thunar thunar-archive-plugin thunar-data thunar-media-tags-plugin thunar-volman ttf-droid tumbler tumbler-common xbrlapi xchat xchat-common xfburn xfce-keyboard-shortcuts xfce4-appfinder xfce4-cpugraph-plugin xfce4-dict xfce4-indicator-plugin xfce4-mailwatch-plugin xfce4-netload-plugin xfce4-notes xfce4-notes-plugin xfce4-notifyd xfce4-panel xfce4-places-plugin xfce4-power-manager xfce4-power-manager-data xfce4-quicklauncher-plugin xfce4-screenshooter xfce4-session xfce4-settings xfce4-systemload-plugin xfce4-taskmanager xfce4-terminal xfce4-verve-plugin xfce4-volumed xfce4-weather-plugin xfce4-xkb-plugin xfconf xfdesktop4 xfdesktop4-data xfwm4 xscreensaver xscreensaver-data xscreensaver-gl xubuntu-artwork xubuntu-default-settings xubuntu-desktop xubuntu-docs xubuntu-icon-theme xubuntu-wallpapers && sudo apt-get install ubuntu-desktop

Or you can use synaptic package manager.

For other Ubuntu releases, click on the desired version. 12.04, 11.10, 11.04, and 10.10.

Source: psychocats

To remove mate-core packages from your Ubuntu installation use following command.

sudo apt-get remove atril atril-common caja caja-common engrampa engrampa-common ffmpegthumbnailer-caja libcaja-extension libmarco libmate libmate-common libmatecanvas libmatecomponent libmatecomponentui libmateconf libmatecorba libmatedesktop libmatekbd libmatekeyring libmatemenu libmatenotify libmatepanelapplet libmatepolkit libmateui libmatevfs libmateweather libmateweather-common marco marco-common mate-applets mate-applets-common mate-backgrounds mate-conf mate-conf-common mate-control-center mate-corba mate-core mate-desktop mate-desktop-common mate-dialogs mate-icon-theme mate-keyring mate-media mate-menus mate-mime-data mate-panel mate-panel-common mate-polkit mate-power-manager mate-power-manager-common mate-screensaver mate-session-manager mate-settings-daemon mate-settings-daemon-common mate-settings-daemon-gstreamer mate-system-monitor mate-terminal mate-terminal-common mate-text-editor mate-themes mate-vfs mate-vfs-common mate-window-manager python-mate

To remove mate-desktop-environment packages use following command.

sudo apt-get remove libmatesensorsappletplugin mate-calc mate-desktop-environment mate-netspeed mate-sensors-applet mate-system-tools mate-utils mozo python-mate-menu system-tools-backends

Source: webupd8


Another method to remove xfce/Xubuntu https://askubuntu.com/posts/145325/

sudo apt-get autoremove --purge $( dpkg-query -l *xubuntu* | grep ii | tr -s " " | cut -d" " -f2; dpkg-query -l *xfce* | grep 'ii' | tr -s " " | cut -d" " -f2 )


To remove cinnamon - https://askubuntu.com/posts/142543/

Boot into Recovery mode and type this for the var/apt/cache error:
sudo mount -n -o remount /

Then disable auto login from virtual console by doing the following
sudo nano /etc/lightdm/lightdm.conf

Some of the lines should look like this

[SeatDefaults]
autologin-guest=false
autologin-user=username
autologin-user-timeout=0
autologin-session=lightdm-autologin
greeter-session=unity-greeter
user-session=ubuntu

Just put a # before all lines starting with autologin

Then whenever you boot into Ubuntu just change the login to unity from the lightdm's login screen options

Also you might want to remove Cinnamon
Then type in the terminal

sudo apt-get --purge autoremove cinnamon


To remove lubuntu/LXDE

sudo apt-get remove abiword abiword-common abiword-plugin-grammar abiword-plugin-mathview ace-of-penguins audacious audacious-plugins audacious-plugins-data blueman catfish chromium-browser chromium-browser-l10n chromium-codecs-ffmpeg elementary-icon-theme fonts-lyx galculator gdebi gdebi-core gecko-mediaplayer giblib1 gnome-desktop-data gnome-icon-theme-full gnome-mplayer gnome-system-tools gnome-time-admin gnumeric gnumeric-common gnumeric-doc gpicview gtk2-engines-pixbuf guvcview hardinfo indicator-application-gtk2 leafpad libaacs0 libabiword-2.9 libass4 libaudclient2 libaudcore1 libavcodec53 libavformat53 libavutil51 libbinio1ldbl libbluray1 libbs2b0 libcddb2 libcolamd2.7.1 libcompfaceg1 libcue1 libdca0 libdirectfb-1.2-9 libenca0 libept1.4.12 libexo-1-0 libexo-common libexo-helpers libfaad2 libfluidsynth1 libfm-data libfm-gtk-bin libfm-gtk-data libfm-gtk3 libfm3 libgdome2-0 libgdome2-cpp-smart0c2a libglade2-0 libgmlib0 libgmtk0 libgmtk0-data libgoffice-0.8-8 libgoffice-0.8-8-common libgsf-1-114 libgsf-1-common libgsm1 libgtkmathview0c2a libgtkspell0 libguess1 libid3tag0 libimlib2 libindicate-gtk3 libjpeg-progs libjpeg-turbo-progs liblink-grammar4 libloudmouth1-0 libmenu-cache1 libmms0 libmodplug1 libmowgli2 libmp3lame0 libmpg123-0 libmusicbrainz3-6 libnet-dbus-perl libobrender27 libobt0 libonig2 liboobs-1-5 libopts25 libots0 libpisock9 libpostproc52 librarian0 libresid-builder0c2a libschroedinger-1.0-0 libsdl1.2debian libsidplay2 libswscale2 libtidy-0.99-0 libtie-ixhash-perl libts-0.0-0 libuniconf4.6 libva1 libvdpau1 libvpx1 libvte-common libvte9 libwebcam0 libwv-1.2-4 libwvstreams4.6-base libwvstreams4.6-extras libxfce4ui-1-0 libxfce4util-bin libxfce4util-common libxfce4util6 libxfconf-0-2 libxml-parser-perl libxml-twig-perl libxml-xpath-perl libxvidcore4 lightdm-gtk-greeter link-grammar-dictionaries-en lm-sensors lp-solve lubuntu-artwork lubuntu-artwork-12-10 lubuntu-core lubuntu-default-settings lubuntu-desktop lubuntu-icon-theme lubuntu-lxpanel-icons lubuntu-software-center lxappearance lxappearance-obconf lxinput lxkeymap lxlauncher lxmenu-data lxpanel lxpanel-indicator-applet-plugin lxrandr lxsession lxsession-data lxsession-edit lxshortcut lxtask lxterminal mplayer2 mtpaint ntp obconf openbox openbox-themes pcmanfm pidgin pidgin-data pidgin-libnotify pidgin-microblog plymouth-theme-lubuntu-logo plymouth-theme-lubuntu-text python-pysqlite2 python-support python-xklavier rarian-compat scrot sylpheed sylpheed-doc sylpheed-i18n sylpheed-plugins synaptic system-tools-backends transmission tsconf uvcdynctrl uvcdynctrl-data wvdial xfburn xfce-keyboard-shortcuts xfce4-notifyd xfce4-power-manager xfce4-power-manager-data xfconf xfonts-100dpi xpad xscreensaver xscreensaver-data && sudo apt-get install ubuntu-desktop && sudo /usr/lib/lightdm/lightdm-set-defaults -g unity-greeter

To remove Kubuntu/KDE

sudo apt-get remove akonadi-facebook akregator amarok amarok-common amarok-utils apport-kde apturl-kde ark audiocd-kio bluedevil calligra-data calligra-libs colord-kde cryptsetup dolphin dragonplayer freespacenotifier gnupg-agent gnupg2 gpgsm gstreamer0.10-qapt gtk2-engines-oxygen gtk3-engines-oxygen gwenview ibus-qt4 kaccessible kaddressbook kamera kamoso kate kcalc kde-base-artwork kde-baseapps-bin kde-baseapps-data kde-config-gtk-style kde-config-tablet kde-config-telepathy-accounts kde-config-touchpad kde-style-oxygen kde-telepathy kde-telepathy-approver kde-telepathy-auth-handler kde-telepathy-contact-list kde-telepathy-data kde-telepathy-filetransfer-handler kde-telepathy-integration-module kde-telepathy-minimal kde-telepathy-send-file kde-telepathy-text-ui kde-wallpapers-default kde-window-manager kde-window-manager-common kde-workspace kde-workspace-bin kde-workspace-data kde-workspace-kgreet-plugins kde-zeroconf kdegames-card-data kdegames-data kdegraphics-strigi-analyzer kdemultimedia-kio-plugins kdenetwork-filesharing kdepasswd kdepim-kresources kdepim-strigi-plugins kdesudo kexi khelpcenter4 kinfocenter klipper kmag kmail kmenuedit kmix kmousetool knotes konsole kontact korganizer kpat kppp krdc krita krita-data ksnapshot ksysguard ksysguardd ksystemlog ktorrent ktorrent-data kubuntu-default-settings kubuntu-desktop kubuntu-docs kubuntu-firefox-installer kubuntu-netbook-default-settings kubuntu-notification-helper kubuntu-web-shortcuts kvkbd kwalletmanager libassuan0 libaudiocdplugins4 libbluedevil1 libcalendarsupport4 libchm1 libcln6 libdebconf-kde0 libepub0 libeventviews4 libfftw3-3 libgpgme++2 libgps20 libgrantlee-core0 libgtlcore0.8 libgtlfragment0.8 libibus-qt1 libincidenceeditorsng4 libindicate-qt1 libkateinterfaces4 libkblog4 libkcompactdisc4 libkdcraw-data libkdcraw21 libkdecorations4abi1 libkdegames6 libkdepim4 libkdepimdbusinterfaces4 libkdgantt2 libkephal4abi1 libkexiv2-11 libkexiv2-data libkipi-data libkipi9 libkleo4 libkmanagesieve4 libkonq-common libkonq5-templates libkonq5abi1 libkontactinterface4 libkpgp4 libkrossui4 libksane-data libksane0 libksba8 libkscreensaver5 libksgrd4 libksieve4 libksieveui4 libksignalplotter4 libktnef4 libktorrent-l10n libktorrent4 libktpchat0 libktpcommoninternalsprivate3 libkunitconversion4 libkwineffects1abi4 libkwinglutils1abi1 libkwinnvidiahack4 libkworkspace4abi2 liblastfm1 liblightdm-qt-2-0 libllvm3.0 libloudmouth1-0 libmailcommon4 libmailimporter4 libmessagecomposer4 libmessagecore4 libmessagelist4 libmessageviewer4 libmuonprivate1 libmygpo-qt1 libokularcore1abi1 libopenal-data libopenal1 libopenconnect2 libopenctl0.8 libopenjpeg2 libopenshiva0.8 libplasma-geolocation-interface4 libplasmaclock4abi3 libplasmagenericshell4 libpoppler-qt4-4 libprocesscore4abi1 libprocessui4a libqalculate5 libqalculate5-data libqca2-plugin-ossl libqgpgme1 libqimageblitz4 libqoauth1 libqtglib-2.0-0 libqtgstreamer-0.10-0 libqtgstreamerui-0.10-0 libqtscript4-core libqtscript4-gui libqtscript4-network libqtscript4-sql libqtscript4-uitools libqtscript4-xml libqtshiva0.1 libreoffice-kde libreoffice-style-oxygen libruby1.9.1 libsolidcontrol4abi2 libsolidcontrolifaces4abi2 libspnav0 libsyndication4 libtag-extras1 libtaskmanager4abi3 libtelepathy-logger-qt4-1 libtelepathy-qt4-2 libtemplateparser4 libweather-ion6 libyaml-0-2 libzip2 lightdm-kde-greeter muon muon-installer muon-notifier muon-updater okular okular-extra-backends oxygen-cursor-theme partitionmanager pinentry-gtk2 pinentry-qt4 plasma-dataengines-addons plasma-dataengines-workspace plasma-desktop plasma-netbook plasma-scriptengine-python plasma-widget-facebook plasma-widget-folderview plasma-widget-kimpanel plasma-widget-menubar plasma-widget-message-indicator plasma-widget-networkmanagement plasma-widget-telepathy-chat plasma-widget-telepathy-presence plasma-widgets-addons plasma-widgets-workspace plymouth-theme-kubuntu-logo plymouth-theme-kubuntu-text print-manager python-pyudev python3-pykde4 python3-pyqt4 python3-sip qapt-deb-installer quassel quassel-data rdesktop rekonq ruby ruby1.9.1 skanlite software-properties-kde systemsettings tasks-icons ubuntu-release-upgrader-qt usb-creator-kde userconfig && sudo apt-get install ubuntu-desktop

[SOURCE]


If it's available on your version of Ubuntu, tasksel is a tool created just for this purpose. Should be installed by default on recent Ubuntu versions.