Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I just did my first install of any Linux OS, and I accidentally selected "Desktop GUI" in the install, but I want to build everything myself. Is there any way by which I can uninstall the GUI environment without re-installing OS?

share|improve this question
up vote 14 down vote accepted

Debian uses tasksel for installing software for a specific system. The command gives you some information:

> tasksel --list-tasks
i desktop       Graphical desktop environment
u web-server    Web server
u print-server  Print server
u dns-server    DNS server
u file-server   File server
u mail-server   Mail server
u database-server       SQL database
u ssh-server    SSH server
u laptop        Laptop
u manual        manual package selection

The command above lists all tasks known to tasksel. The line desktop should print an i in front. If that is the case you can have a look at all packages which this task usually installs:

> tasksel --task-packages desktop

On my system the command outputs 36 packages. You can uninstall them with the following command:

> apt-get purge $(tasksel --task-packages desktop)

This takes the list of packages (output of tasksel) and feeds it into the purge command of apt-get. Now apt-get tells you what it wants to deinstall. If you confirm it everything will be purged from your system.

share|improve this answer
Hm, what do you make of this, with tasksel --task-packages desktop I only get task-desktop? But I have some of those packages (e.g., twm). – Emanuel Berg Nov 21 '12 at 22:55
What is the output of tasksel --list-tasks | grep "^i"? Is the package desktop-base installed? – qbi Nov 22 '12 at 21:03
tasksel --list-tasks | grep "^i" doesn't give my anything: I have only u lines for tasksel --list-tasks, including u desktop Debian desktop environment. aptitude show desktop-base says that package (desktop-base) is installed, though. Are those related? I'm not sure what to make of this. – Emanuel Berg Nov 22 '12 at 22:21
This answer partially worked for me, but I also had to: dpkg --get-selections (showed me that I had xserver packages installed), apt-get purge xserver-* (delete all the xserver packages). – Daniel Bank Oct 28 '15 at 16:17

It means Debian changed the behaviour of this by now using a single "meta" package called task-desktop which pulls in the other packages via dependencies and recommends. So it's true what tasksel tells you, it just installs that single package, but if you look at the details of that, like so:

apt-cache show task-desktop

you will see the other (actual) packages this pulls in in the lines starting "Depends:" and "Recommends:". To remove them try "apt-get remove task-desktop" or list the package names individually.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.