Why removing the xfce4 package doesn't remove the XFCE desktop environment?

I wanted a window manager, so I installed xfce4. I used

sudo apt-get install xfce4

to do this. To remove it, I used

sudo apt-get remove --purge xfce4  

which didn't work, and neither did

sudo dpkg purge xfce4

as evidenced 1) startx launches the xfce desktop, and 2) apt-cache search xfce4 returns a long list of installed packages.

So, how can I get rid of xfce4 and it's dependencies?


xfce4 itself is a meta-package that will install a default configured xfce desktop environment.

In most cases the base files that comes with xfce4 are: xfconf, xfce4-utils, xfwm4, xfce4-session, thunar, xfdesktop4, exo-utils

So you can do

sudo apt-get purge xfconf xfce4-utils xfwm4 xfce4-session thunar xfdesktop4 exo-utils xfce4-panel xfce4-terminal

Then most of the package that were associated with these package become autoremovable so you can run

sudo apt-get autoremove

or, almost all xfce4 package depend upon libxfce4util-common. Just purge that one and you remove everything related to xfce


Note that apt-cache is not showing you installed packages, but rather those which are known about.

To test what you have installed, you might like to use:

dpkg --get-selections | grep xfce

Be sure to look at the second output column to see whether it's installed or deinstalled.

After purging all xfce packages, the above command returns no output on my machine.


Aptitude can do this by using package search ~n and using -P to prompt when adding or removing packages.

sudo aptitude -P remove ~nxfce4

Substitute remove with purge if you would like to remove the system configuration files:

sudo aptitude -P purge ~nxfce4

To remove user config files (use -r with care - recursive delete!!):

sudo rm -r ~/.config/xfce4

sudo aptitude purge xfce4 desktop-base exo-utils gtk2-engines-xfce libexo-1-0 libexo-common libgarcon-1-0 libgarcon-common libthunarx-2-0 libtumbler-1-0 libxfce4ui-1-0 libxfce4util-bin libxfce4util-common libxfce4util4 libxfconf-0-2 orage tango-icon-theme thunar thunar-data thunar-volman tumbler tumbler-common xfce-keyboard-shortcuts xfce4 xfce4-appfinder xfce4-mixer xfce4-panel xfce4-session xfce4-settings xfce4-utils xfconf xfdesktop4 xfdesktop4-data xfwm4 xfwm4-themes

Will remove everything related with xfce4 in your computer. You will need to install aptitude first if you haven't:

sudo apt-get install aptitude

I think you should try aptitude.

Install it: sudo apt-get install aptitude

Maybe you will have first to install again xfce4: sudo aptitude install xfce4

Now purge it: sudo aptitude purge xfce4


ps.: I've never installed xfce4 but the command apt-cache search xfce4 also gives me this output.