How can I restart Compiz from a TTY? (& Related, how can I set up a fallback WM?)
Switch to terminal number 1 (Ctrl+Alt+F1) and run
DISPLAY=:0 unity --replace
or
DISPLAY=:0 compiz --replace
Sometimes it doesn't restart. Just kill all compiz
processes and try again in case.
You need to set the DISPLAY environment variable, in the usual case of a single Xorg instance you can do that with
export DISPLAY=":0.0"