Restarting Gnome-Shell from terminal

My Gnome-Shell had just gone bananas, so I needed to restart it (I'm using Gnome-shell 3.4, and this happens like 2 times per month). Normally I restart it from inside the shell or restart the login manager but I didn't want to lose all the open programs, so I used the SIGHUP signal. For completness, here are all my ways of doing it.

Restarting from inside the Shell

from inside the shell: alt+F2 , r, enter. You will not lose all the open programs.

Restarting gdm3 login manager from TTY

One can restart the login manager, but that way you lose all the open programs that were inside the shell. Do it with:

sudo service gdm3 restart

Using SIGHUP signal from TTY

SIGHUP signal was originally designed to notify the process of a serial line drop (a hangup). In modern systems, this signal usually means that the controlling pseudo or virtual terminal has been closed1. So SIGHUP basically lets the programmer define the procedure to be executed when it's received. Gnome developers have implemented such a prodecure that restarts the Gnome-shell, without killing child processes. Perfect! . You can use it with:

sudo killall -s SIGHUP gnome-shell

Víctor Cuadrado Juan

I'm Víctor Cuadrado Juan, a developer and FOSS enthusiast, in love with Linux. Currently living in Nürnberg, Germany. Feel free to waste your precious time around here, or to contact me.