Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. 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 wanted to execute some command in terminal emulator, like Konsole, but I need to make this cross-desktop.

Is there some command like xdg-open, but for getting the default terminal emulator?

I'm using Ubuntu.

share|improve this question
up vote 4 down vote accepted

In Debian, you could just call x-terminal-emulator -e /some/command, as this points to the terminal emulator configured by Debian's "alternative" mechanism. It's configured via

# update-alternatives --config x-terminal-emulator

which lets you chose which of the installed X11 terminal emulators to use as the default one, i.e. as x-terminal-emulator. In the end, it's a symlink construction, e.g. for gnome-terminal:

$ which x-terminal-emulator
$ ls -al /usr/bin/x-terminal-emulator 
lrwxrwxrwx 1 root root 37 Apr 26  2010 /usr/bin/x-terminal-emulator -> /etc/alternatives/x-terminal-emulator
$ ls -al /etc/alternatives/x-terminal-emulator
lrwxrwxrwx 1 root root 31 Apr 26  2010 /etc/alternatives/x-terminal-emulator -> /usr/bin/gnome-terminal.wrapper
$ file /usr/bin/gnome-terminal.wrapper
/usr/bin/gnome-terminal.wrapper: Perl script, ASCII text executable

Some remarks,

share|improve this answer
Works in Ubuntu , thanks – warl0ck Feb 24 '12 at 8:59
Unfortunately, it does not work on Fedora 16 with Gnome 3.2.1 – fheub Feb 24 '12 at 9:52
@AaronLewis Note that this is the system default. I don't think there's any standard way of obtaining the user's favorite X terminal emulator. – Gilles Feb 24 '12 at 19:06

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.