On my Ubuntu 14.04 virtual machine compiz freezes often. I usually swtich to tty1 and kill the process, then switch back to tty7 and, if I can see a terminal window, I run compiz --replace & in it.But there are times when I don't see any terminal window, and right clicking on the desktop doesn't give any menu so I can open one and I have to restart lightdm service. This is work blocking.My question is: how can I run compiz --replace & or any other command from a different tty on tty7?I read this thread, but I don't know how to make tmux connect to a different tty on my machine, and the second one involves using the homebrew program.I also read this, but it involves having a daemon run on tt7 expecting for my commands.Isn't there any easier way to do this?
Run an X11 command from a different console
x11;console
What matters is actually not what console you run the command from, but that you tell the program to connect to the still-existing X display. To do this, set the DISPLAY variable and restart Compiz from a standard terminal. Depending on your distribution and configuration, you may need to set XAUTHORITY as well. Switch to tty1 and type:$ export DISPLAY=:0$ compiz --replace &The display may be different on your machine. Use who to find yours:$ whoyou     tty1    [time]             < This is you from tty1.you     :0      [time] (:0)        < This is you from tty7.        ^^              ^^   This is your display on tty7Note: you must be logged in as yourself on tty7 (graphically). Fortunately, when Compiz crashes, you are not disconnected from tty7 (even though you can't do much).