How to run any command in another terminal window?

Example: I opened one terminal window and if I run command like apropos editor, then it run and out-puts on that window. But I want to run same command on another terminal window (new window) instead on present window from first terminal.

Further clarification:
I need suggest-command <command> that open new terminal window and run mentioned <command> in that (newly opened) window. (where suggest-command is example of suggestion of command.)

How to do that?

  • 1
    Right-Click on the terminal icon and click on "Open New Terminal". – Raphael Jun 18 '14 at 12:08
  • Sorry if I sound like a lamen, but that's what I understood from your question. – Raphael Jun 18 '14 at 12:09
  • gnome-terminal right? – Braiam Jun 18 '14 at 14:19
  • While opening a new terminal may solve your problem, you might also wish to simply use nohup, re-direct the output, and put your editor in the background. nohup apropos editor &> /dev/null & – Panther Jun 18 '14 at 15:27
  • I also do not understand: why not to open a new terminal? – Josef Klimuk Jan 9 at 11:27
up vote 23 down vote accepted

This might be what you search:

gnome-terminal -e "bash -c \"!!; exec bash\""

or (shortly):

gnome-terminal -x sh -c "!!; bash"

It opens gnome-terminal with your last command (!!) executed and it stays open with the command output in the shell, even with an interactive command like top or less...

In your case its:

gnome-terminal -e "bash -c \"apropos editor; exec bash\""


gnome-terminal -x sh -c "apropos editor; bash"
  • 2
    A little bit shorter gnome-terminal -x sh -c "!!; bash" – TuKsn Jun 18 '14 at 13:22

Start another instance of whatever terminal is it you want to run:

xterm -hold -e 'apropos editor' & 

Note the -hold. Most terminals will exit after running the command you feed them. There are already a dozen or so questions about this on the site:

An alternative to that is to use an application which needs to be exited. nano will stay open on its own. If you're just outputting to screen, you could pipe it into less:

xterm -e 'apropos editor | less' & 

That said, in your case (as the other two have said) it does seem easier that you just open another terminal and run your command.

  • Can I use gnome-terminal instead of xterm then How to? – Pandya Jun 18 '14 at 12:23
  • I'm curious about how to do this with xfce4-terminal (xfce4-terminal opens a new process, while xterm doesn't—in my case, I actually don't want a new process). – Shule Jan 20 '16 at 7:49

Each terminal is even a program that you can launch as any other program, with & to put in background, giving a list of arguments and so on.

Which terminal to use it depends first from the availability of the system that you are using (if they are installed or not), after from their peculiarity and then from your personal taste.

  konsole   --hold -e "ls" &  
  xterm      -hold -e "ls" &  
  gnome-terminal   -e "ls" & ...  

Note the differences between -hold of xterm and --hold of konsole.

Each realization has different options that you have to check with the help. Even the help can be invoked in different way. You can find that man konsole doesn't function and so you have to ask directly to the executable with --help.

This is a list of terminal you can search on your system

aterm          - AfterStep terminal with transparency support
gnome-terminal - default terminal for GNOME
guake          - A dropdown terminal for GNOME
konsole        - default terminal for KDE
Kuake          - a dropdown terminal for KDE
mrxvt          - Multi-tabbed rxvt clone
rxvt           - for the X Window System (and, in the form of a Cygwin port, 
                 for Windows) 
rxvt-unicode   - rxvt clone with unicode support
xfce4-terminal - default terminal for Xfce desktop 
                 environment with dropdown support
Terminator     - is a GPL terminal emulator. It is available on
                 Microsoft Windows, Mac OS X, Linux and other Unix X11 systems.
Terminology    - enhanced terminal supportive of multimedia 
                 and text manipulation for X11 and Linux framebuffer
tilda          - A drop down terminal
wterm          - It is a fork of rxvt, designed to be lightweight, but still
                 full of features
xterm          - default terminal for the X Window System
Yakuake        - (Yet Another Kuake), a dropdown terminal for KDE

You could use the -e option to gnome-terminal as follows:

gnome-terminal -e 'sh -c propose editor'

Here sh is the shell that gnome-terminal opens. Note that this will exit the terminal as soon as the command has terminated. Refer to the manual page for gnome-terminal for more.

  • How to hold new opened terminal, which is exiting after command finished/terminated? – Pandya Jun 18 '14 at 12:27
  1. Open two terminals;
  2. Identifying each terminal with tty command;
  3. Supposing they identified with /dev/pts/0 and /dev/pts/1;
  4. In terminal pts/0 redirecting stdout to pts/1 with exec command: exec 1>/dev/pts/1
  5. Now every command stdout output from pts/0 terminal is displaying in pts/1;
  6. Redirecting back stdout with commad: exec 1>/dev/pts/0
  7. Now pts/0 stdout working as before.

YouTube video:

Your Answer


By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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