I have a script in a gnome-terminal shell and I would like to open a new terminal, load the bashrc configuration, execute a new script and avoid the closure of the new terminal window.

I have tried to execute this commands:

gnome-terminal -x bash

the script above open a new shell and loads bashrc, but I don't know how to execute a script automatically.

gnome-terminal -x ./new_script.sh

the script above open a new shell and execute the script but doesn't load bashrc and close the window.

The result that I would like to obtain is to feel like opening a new terminal as clicking the term icon but execute a script after the bashrc setup.

gnome-terminal -e command


xterm -e command


konsole -e command

Pretty much

terminal -e command

To make the terminal stay when the command exits:

In konsole there is a --noclose flag.

In xterm, there is a -hold flag.

In gnome-terminal, go to Edit -> Profile Preferences -> Title. Click the Command tab. Select Hold the terminal from the drop-down menu labelled When command exits. You should create a new profile for that and execute with

gnome-terminal --window-with-profile=NAMEOFTHEPROFILE -e command
  • Thanks! But I don't see the bashrc output when I run gnome-terminal -e ./new_script.sh --window-with-profile=my_profile. Have I forgotten something? – Cyr Jan 31 '17 at 11:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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