gnome restart gdm code example
Example: restart gnome from terminal
If the gnome reponses, minimally:
Alt + F2, than typing 'r' and ENTER
If it not, go to a lower terminal (CTRL+ALT+F1,2,3,4 or whatever till 7)
Login, and kill gnome-shell (it will restart)
$ killall -HUP gnome-shell