should show a list of package "groups", you should see one called "X Window System" or similar.. If I got the command right the command to remove the WHOLE gui will be:
yum groupremove "X Window System"
for the next question, install yum utils.
yum install yum-utils
then the I think command to clean up orphans will be