I find useful the gnome-terminal feature of editing (and creating) profiles with the option of holding the terminal open after the command exists.

enter image description here

(I like to use context menu file manager to run commands to display info about a file in a terminal, to show info in a terminal while processing, etc.)

I wasn't able to find the same feature in other terminals, so I have to install gnome-terminal even when it's not the default terminal.

Are there other terminal emulators with this feature? Is there a command to be used in a given terminal that would have the same effect?

I want, with a single line (to be added as context menu entry), to open the terminal, run a command and display info in the terminal window that stays open. Example: in pantheon-files (elementary os) I add a context menu entry for media info using a contractor file with a line like Exec=xterm -hold -e "mediainfo -i %f" (according to a comment below) or Exec=gnome-terminal --window-with-profile=new1 -e "mediainfo -i %f".

  • 1
    Run tmux in whatever terminal, then run your command in tmux?
    – lcd047
    Commented May 23, 2015 at 13:23
  • The MacOS Terminal.app is one terminal application that has that feature. But I strongly suspect you're not running MacOS!
    – Celada
    Commented May 23, 2015 at 13:56
  • 1
    xterm has a -hold option - but what other terminal emulators are you using or are familiar with?
    – D McKeon
    Commented May 23, 2015 at 16:40
  • @Celada - yes, this is a linux question; I added the tag now
    – user32012
    Commented May 25, 2015 at 7:12
  • @DMcKeon - beside gnome-terminal, I normally use xce4-terminal and pantheon-terminal, but I could install others that would easily include the option. The more basic xterm -hold should be posted as answer..
    – user32012
    Commented May 25, 2015 at 7:17

5 Answers 5


You can achieve this in any terminal emulator by the simple expedient of arranging for the program not to exit without user confirmation. Tell the terminal to run terminal_shell_wrapper which is a script containing something like

if [ $# -eq 0 ]; then "${SHELL:-sh}"; else "$@"; fi
echo "The command exited with status $?. Press Enter to close the terminal."
read line

If you want any key press to close the terminal change read line to

stty -icanon; dd ibs=1 count=1 >/dev/null 2>&1
  • But how to integrate the terminal running terminal_shell_wrapper with it running the command that I want from context menu? Example: in pantheon-files (elementary os) I add a context menu entry for media info using a contractor file with a line like Exec=xterm -hold -e "mediainfo -i %f" (according to a comment above) or Exec=gnome-terminal --window-with-profile=new1 -e "mediainfo -i %f". How to adjust your solution to a such purpose?
    – user32012
    Commented May 25, 2015 at 7:33
  • can i run the script AND my intended command (e.g. mediainfo -i %f) with a single command line (which would then be my context menu entry)?
    – user32012
    Commented May 25, 2015 at 8:08
  • 1
    Add terminal_shell_wrapper as a prefix to your command, e.g. xterm -e terminal_shell_wrapper mediainfo -i %f is equivalent to xterm -hold -e mediainfo -i %f Commented May 25, 2015 at 11:45

There are other terminals that have options to keep the terminal open, some by specifying a profile with that setting enabled (just like in Gnome Terminal) and some with a specific argument.


xterm -hold

from $(man xterm):

-hold Turn on the hold resource, i.e., xterm will not immediately destroy its window when the shell command completes. It will wait until you use the window manager to destroy/kill the window, or if you use the menu entries that send a signal, e.g., HUP or KILL.

Running xterm --help, one of the lines is

-/+hold turn on/off logic that retains window after exit

To see if other terminals have a similar option, look at their help or man page.


(default in KDE):

konsole --help shows this line:

--hold, --noclose Do not close the initial session automatically when it ends.

So, the command to use for Konsole will include:

konsole --hold or konsole --nonclose. It does not need quotation marks. It could be something like:

Exec=konsole --hold -e mediainfo -i %f


Tab Options:
  -x, --execute; -e, --command=command; -T, --title=title;
  --working-directory=directory; -H, --hold


xfce4-terminal -H -e '<command>'


It has an option similar to that in Gnome Terminal, you have to create a profile - e.g. called "hold" - with that option enabled.

To run command and stay open:

terminator -e '<command>' -p hold.

some_command | cat - /dev/tty

...will work with anything, pretty much. If the launcher you use doesn't properly handle pipelines in a command, you might want...

sh -c 'some_command | cat - /dev/tty'

You can send an interrupt with CTRL+C to kill cat and end the session, or else just close the terminal window when ready.


why not try guake? It's always running in background,and when you want to use it,press the hot key it will show up!

For more detail click here

  • You mean I don't need a special option to hold Guake open because it stays open by default. Only that it is also hidden by default. I see that guake -h says: -t, --toggle-visibility Toggles the visibility of the terminal window. But running a command like Exec=guake -t -e "mediainfo -i %f" keeps Guake hidden, and I have to make it visible with the shortkey to see the info. I guess guake -t should make it visible if it is not. Shouldn't it?
    – user32012
    Commented Sep 10, 2015 at 19:28

Put $SHELL at the end of your bash file.

You must log in to answer this question.