I would like to write a script that runs multiple programs/commands 'program1', 'program2', 'program3'... in a mosaic of terminal in one single window using gnome-terminal and also using tmux (I mean I want to know both ways).

How is it possible ?

I know that this topic mentions it, but it's not exactly what I want. Since I don't want the terminal to close when the program has finished.

2 Answers 2


You can keep the terminal open by following the command with something that waits for user input:

tmux new-window 'make ; read'

If your shell doesn't support the read builtin, you could use eg. sed -n q.


Put everything in a script like this:

#! /bin/bash
su -c '/usr/bin/tmux new-session -s "all" -d'
tmux send "path of Program 1" C-m
tmux rename-window "Program 1"

tmux new-window
tmux send "path of Program 2" C-m
tmux rename-window "Program 2"

tmux new-window
tmux send "path of Program 3" C-m
tmux rename-window "Program 3"

tmux attach

It will start a new tmux session called all with 3 windows called Program1,Program2 and Program3 each one executing each program.

Even if a program stops the window won't close.

  • I have tried what you say but no window appears. I replace "path of Program 1" with "$AtmosBrokerPath/AtmosBroker -v" in my case. ($AtmosBrokerPath is a path that I initialize in the script) May 27, 2016 at 9:31
  • Did you mean send-keys, not just send?
    – JigglyNaga
    May 27, 2016 at 9:43
  • Soory. My bad. It lacked the command tmux attachat the end. I corrected it.
    – jcbermu
    May 27, 2016 at 9:44
  • Do you need to run these commands as root ? May 27, 2016 at 12:07
  • @bam500 Not necessarily. As log as the user can run tmuxand the Programs it will work.
    – jcbermu
    May 27, 2016 at 12:39

You must log in to answer this question.

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