Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free.

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

What command should I give to make a program run in a (new) terminal window?

Background: I want to add another right-click option to Peazip which will pass the selected par2 file to the (installed) program par2, but I want it to run in a terminal, rather than the in the background.


share|improve this question
up vote 1 down vote accepted

If you want to run a specific terminal emulator (e.g. xterm, konsole, gnome-terminal, etc.), just look for its command-line arguments.

For example, to run console utility htop in Konsole (KDE's default terminal), type:

konsole -e /bin/sh -c htop

(You may want to add --hold argument to prevent Konsole closing immediately after process stops.)

To be more detailed: the above command runs konsole which runs /bin/sh interpreter inside itself, and the interpreter runs htop command inside itself.

Arguments of most popular terminal emulators are pretty similar, try these:

xterm -e /bin/sh -c htop
lxterminal -e /bin/sh -c htop
xfce4-terminal -e "/bin/sh -c htop"
share|improve this answer
Thank you, that's great. Is there a way of setting the new terminal window to show the command that has been passed to it? In your example: htop – user157109 May 9 '13 at 12:22

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.