If you’re having a problem with GNOME, it’s easy to restart it from a terminal. A common issue you can fix is playing a 3D game that crashes and locks the mouse and keyboard.
In Ubuntu and many other distributions you can use this command to restart the GNOME display manager:
sudo /etc/init.d/gdm restart
You can also simply start or stop it: