I'm fairly good with windows .bat scripts and normally use the pause command while developing them so I can see things step by step as the script runs in the command prompt. I am trying to do something similar with a Linux Bash file. I have a very simple bash, which can be seen below...

echo Hello World!
read -p "Press [Enter] key to continue..."

I configured Nautilus (a Linux file management program) to "Run executables when they are double clicked" but I don't see anything when I double click the script. Do I need to re-route output to the console or something?


Here is how I achieved what I wanted...

  1. Create a .sh file (I am using one from above)
  2. Open Nautilus
  3. Click Edit -> Preferences -> Behavior tab
  4. Under "Executable Text Files" choose "Ask Each Time" Radio button

Now when you click on .sh files, you will be prompted with a few options. Option "Run in Terminal" does exactly what I want. Thanks everyone for the contributions!

  • Look at your running processes with ps -ef, you will see something running there. Commented Sep 7, 2014 at 19:26

2 Answers 2


You need to launch a terminal, which in turn launches the script.

Try this:

xterm -e "echo Hello World; read -p 'Press [Enter] key to exit ..."

This is of course impractical for a longer script. But then you can simply do:

xterm -e /home/user/scripts/thescript.sh

and thescript.sh contains all the commands you want to use. Make sure it is executable (chmod +x thescript.sh)

  • I figured out how to do exactly what I wanted, I added the edit above. What exactly does xterm do?
    – Jason
    Commented Sep 8, 2014 at 20:23
  • Congratulations. Xterm is just a terminal emulator. See man xterm. You might prefer another one. E.g. gnome-terminal.
    – Sebastian
    Commented Sep 9, 2014 at 4:49

Your script needs a terminal for you to interact with it. One way of doing that is what @Sebastian suggested. However, note that bash scripts are not really designed to be run this way. A cleaner way would be to write a .desktop file that launches your script and then double click that. Something like:

[Desktop Entry]

Save that file as foo.desktop in your ~/Desktop folder. That will now appear as an icon there and double clicking it will cause your script to be run in a terminal. Obviously, you need to change /home/user/yourscript.sh to the actual path of your script.

  • With your terminal emulator, how can we redirect stdin , stdout and stderr to /dev/null? Thank you.
    – Frank
    Commented May 28, 2016 at 4:50
  • @Frank I don't know. I would do it by editing the script itself or writing a wrapper script.
    – terdon
    Commented Jun 1, 2016 at 10:02
  • You can consider my script here to generate these files - just switch Terminal= from false (there) to true (here)
    – Cadoiz
    Commented Nov 5, 2021 at 16:27

You must log in to answer this question.

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