Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'd like to know or it is possible to set up the GNOME Terminal in a way that when I open up the terminal and there is already an instance open it'll show that instance and not open up a brand new one.

share|improve this question
what version of ubuntu are you using, and which environment? I ask, because what you are describing is the default setup in unity and gnome-shell. – severin Nov 24 '11 at 12:57
I’m using Ubuntu 11.10 with Unity-2D. I haven’t done a clean install but an upgrade from 11.04. – Mood Nov 25 '11 at 0:46
Do you use Ctrl+Alt+T as a shortcut? – int_ua Dec 9 '11 at 12:54
Yes I do.That or I start up a terminal typing “ter » enter” in Kupfer. Those are the the 2 methods I use. Because I don't look on the Unity laucher all too often I end up with 3, 4 different terminals. – Mood Dec 10 '11 at 17:18
up vote 7 down vote accepted

I wrote a simple shell script using wmctrl to give the Terminal focus. It does exactly what I want.

First, install wmctrl sudo apt-get install wmctrl.

Next, fire up a text-editor, copy the following lines.


if ps ax | grep -v grep | grep $SERVICE > /dev/null
  wmctrl -xa $SERVICE

Save the file somewhere where you usually keep your shell scripts. In my case I did: ~/bin/

cd to the directory (cd ~/bin) and make the file executable chmod +x

Now, open up Main Menu select Accessories » Terminal press properties and replace command with the script: ~/bin/

Open up System Settings » Keyboard » Shortcuts. Disable Launch Terminal shortcut by giving it a backspace. Make a custom shortcut. Again fill in the path and name to the script and give it the key combination ctrl + alt + t.

You’re done, single instance terminal...

share|improve this answer
Why not just make your script the default terminal launcher? Why all the steps to add shortcuts and all? +1 for the script, -1 for the implementation. – Bruno Pereira Dec 12 '11 at 16:18
In all honestly… I don't know how to do that. I’ve looked at default applications and didn't see terminal. Also I'm convinced that the previous version of Ubuntu had text-fields where commands could be entered. This version of default apps is all drop down menus. – Mood Dec 12 '11 at 19:21

Add --tab to the launcher command. Then you end up with only one app. open.

~$ gnome-terminal --help-all
--tab       Open a new tab in the last-opened window with the default profile
share|improve this answer
No, I don't want a new tab. I want the terminal to move to the foreground in the state I last left it. – Mood Dec 12 '11 at 11:28

It is the default behavior if you use Mod4+# (Mod4 = Super = "Windows" key, # is number in launcher) shortcut to open any application.

share|improve this answer
Yes I’m aware of that. Still, I have to have a terminal open to begin with. I meant when I press control + alt + t or open it up in Kupfer. I’m looking for the same behavior as – for example – Chrome: If an instance is open show me that instance, if there no instance open a new instance. – Mood Dec 10 '11 at 13:04

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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