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
    Commented Jun 18, 2014 at 12:08
  • Sorry if I sound like a lamen, but that's what I understood from your question.
    – Raphael
    Commented Jun 18, 2014 at 12:09
  • gnome-terminal right?
    – Braiam
    Commented Jun 18, 2014 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
    Commented Jun 18, 2014 at 15:27
  • 1
    because it might have to be done by a cron job, or another robot program.
    – DragonLord
    Commented Oct 14, 2020 at 19:50

8 Answers 8


This might be what you run:

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

In older versions, -e and -x were used:

gnome-terminal -e "bash -c \"!!; exec bash\""
# or
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 -- sh -c "bash -c \"apropos editor; exec bash\""

or in older versions:

gnome-terminal -c "bash -c \"apropos editor; exec bash\""
# or
gnome-terminal -x sh -c "apropos editor; bash"
  • 2
    A little bit shorter gnome-terminal -x sh -c "!!; bash"
    – TuKsn
    Commented Jun 18, 2014 at 13:22
  • 1
    Option “-x” is deprecated and might be removed in a later version of gnome-terminal
    – Klesun
    Commented Jan 11, 2020 at 12:34
  • Under Xubuntu, the terminal command is xfce4-terminal, see it's documentation for more details: docs.xfce.org/apps/xfce4-terminal/command-line Commented Nov 26, 2020 at 11:22
  • Even simpler: gnome-terminal -- bash -c "YOURCOMMAND ; exec bash"
    – AgentRev
    Commented Nov 10, 2023 at 16:26

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
  • Most comprehensive answer.
    – liakoyras
    Commented Apr 13, 2023 at 7:14

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
    Commented Jun 18, 2014 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). Commented Jan 20, 2016 at 7:49

After Ubuntu 18.04 LTS, you may want to switch from -e to --, i.e. gnome-terminal -e to gnome-terminal -- because -e and -x are both deprecated.

  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 command: exec 1>/dev/pts/0
  7. Now pts/0 stdout working as before.

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
    Commented Jun 18, 2014 at 12:27

Here goes my 50 cents with Terminator:

terminator -x "script.sh; bash"

This also works, but I can't tell you the difference:

terminator -e "script.sh; bash"

Note that script could also be a command.

Tested on Ubuntu 18.04 LTS.


So I know this is like 7 years late, but for anyone else seeing this it should still be helpful. I was having this exact problem too but found a solution that I think is better than what anyone else has suggested.

Per man gnome-terminal you can just execute gnome-terminal -- sh -c '<your command>'

The -- sh allows it to run actual scripts instead of applications, so it would be just like typing it into a normal window. The only thing to note about this solution though is that the terminal will quit after the command is done executing.

Hope this helps!

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .