Here is what's happening.

I started updating my laptop from 12.04 to the next one (command line) and was surfing the web. At some point everything vanished from the screen except the Firefox window content. In addition, the keyboard shorcuts stopped working ( Alt+Tab , Alt+Esc , Alt+F2 etc.) This means that I can't switch to the update terminal, where I think the update is stalled asking for a Y/N. I managed to run a new terminal by opening nautilus from the desktop and browsing to gnome-terminal.

Q1: Is there a way to switch a window from the terminal so that I can continue the upgrade?

Q2: What would happen if I just reboot in the middle of the upgrade process.

Note : I can't install any new software (such as wmctrl) since the upgrade has a lock on the packages.

Edit 1: I built wmctrl from source, but wmctrl -l doesn't list the Gnome-Terminal windows for some reason.

Edfi 2: I managed to get the upgrade terminal window back by just starting unity from the other terminal. Shortcuts still don't work, so now I have part screen firefox par screen terminal but can't do anything else until the upgrade is done.

1 Answer 1


I can answer the first question:

Q1: Is there a way to switch a window from the terminal so that I can continue the upgrade?

With xdotool you can control and manipulate x windows. But before you can use xdotool you have to export the 2 variables $DISPLAY and $XAUTHORITY. Both of them you will get trough the proc filesystem:

user@host:~$ cat /proc/`pidof gnome-terminal`/environ|tr "\0" "\n" | grep DISPLAY
user@host:~$ cat /proc/`pidof gnome-terminal`/environ|tr "\0" "\n" | grep XAUTHORITY

Export the variables:

user@host:~$ export DISPLAY=:0.0
user@host:~$ export XAUTHORITY=/var/run/gdm/auth-for-user-gDwGgG/database

So, preparatory work done! With the following command you can get the window identifiers:

user@host:~$ xdotool search --onlyvisible --pid `pidof gnome-terminal`

Then you can activate this window:

user@host:~$ xdotool windowactivate 50331653

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.