How do I remove all desktop-related packages, leaving server only? [duplicate]

I've got a VPS server, on which I surprisingly find packages like bluez or thunderbird-gnome-support or firefox or libqt4.

Do I have to list all the packages like in "How to delete all desktop environments except Unity?"?


Solution 1:

To remove x11 and everything that uses it:

apt-get purge libx11.* libqt.*

Solution 2:

You can use Tasksel It is a a tool that install/removes packages as per the type of system you require.

https://help.ubuntu.com/community/Tasksel