I installed Terminator on my Ubuntu and I saved my own layout with 5 terminal windows. Now I want to execute a shell script in each window. The problem is that when script terminates the terminal window becomes useless as there is no more command prompt. i.e. I can save my layout and put a command "top" in layout config. The next time I start Terminator "terminator -m -l mylayout &" it will open my layout, execute command "top" in the respective sub terminal, but if I press "q" to quit "top" that terminal doesn't have command prompt any more. Is there a way to fix it? And, Is there a way to pass commands to terminal windows inside Terminator layout from a separate gnome-terminal window?

3 Answers 3


I also wanted to start a Terminator session by executing a script and then starting a bash shell. This is how I did it:

In Terminator's Preferences, on the 'Layouts' tab, select the desired Layout on the left and then select the desired Terminal on the right.

In the 'Custom command' field, enter the command followed by && bash || bash. This will initiate a new bash shell whether the command/script was successful or not.

The bash after && will execute after a successful exit code (0). The bash after || executes after an error exit code (1-255).

Example: To execute top and then exit into a new bash shell, enter this in the 'Custom command' field.

top && bash || bash

Another example: Say you needed some encouragement to get the day started off on the right foot.

echo -e "\nWelcome! You are going to have a productive day!\n" && bash || bash

Then, to run the command specified, start terminator with the -l option followed by your layout name.

terminator -l mylayout
  • That is a nice solution... there should have been a checkbox though keep terminal active
    – TacB0sS
    Nov 30, 2014 at 15:31

You can use a custom profile for terminals you want to keep open after the command exits. See the Profile, Command tab in Prefs.You can either have them just hold open till you explicitly close them, or you can have them restart the command (either the bash, or the custom command.)

Another trick I recently learned is to use the following as your custom command:

bash --rcfile <(echo ". ~/.bashrc && ls -l")

It sources your bash startup, executes a command (ls), then deposits you in the same bash process. It is slightly better than the practice of tacking bash on the end of the command.


I know this is an older question but I spent some time trying to figure it out today and none of this was working for me. I stumbled accross this blog post that did exactly what I needed. So I figured I would share.

Basically, you add this snippet to your .zshrc or .bashrc:

echo $INIT_CMD
if [ ! -z "$INIT_CMD" ]; then
    setopt shwordsplit
    for cmd in $INIT_CMD; do
        print -s "$cmd"  # add to history
        eval $cmd
    unset INIT_CMD

And then you set this as your custom command:

env INIT_CMD="cd bla; export PYTHONPATH=/tmp; workon project" zsh

That lets you string multiple commands together and then when you end a persistent command with Ctrl+C the terminal stays open.

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.