Replacing GNOME Shell within GNOME Session
In case that GNOME Shell starts to go slow you might want to replacing/restart it.
The easiest way is to <ALT+F2> + “r”
You can also do that from a terminal:
$ gnome-shell -r (--replace)
Notice that if you restart GS within a Terminal, if you close the Terminal you will actually kill GS :)
Replacing GNOME Shell from Console
Sometimes Shell can completely crash like the figure bellow..
In this case we can’t either <ALT+F2> or write on Gnome Terminal -if we had one open. We could restart the PC or GDM from our Console, but this will close all our windows and we might lose some work.
Instead we can try to replace GNOME Shell from the Console. Press <Ctrl+Alt+F2> to go in your TTY2. Login and then type:
$ gnome-shell --replace
That will output you a message that gnome-shell cannot open display, or something like that. So we need to run this for the current X Display. Type again:
$ DISPLAY=:0 gnome-shell --replace
This will export DISPLAY variable to 0 for the current command only. Notice that “0″ is the display that Fedora uses. Ubuntu uses 6 or 7. So you can now restart Shell without lose any time by restarting the whole system ;)
To restart GDM you can either from your Console
$ sudo service gdm start|stop|restart
$ sudo systemctl start|stop|restart gdm
or just kill it and it will auto-restart
$ sudo killall -9 gdm or gdm-binary