Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I wanted to launch a few commands simultaneously in tmux or gnome-terminal or xfterminal , every different tab with a single command running , and close that tab when that command finishes.

Any other software is welcomed as well

I wanted to issue a single script to do the job , e.g XX "cmd1" "cmd2" "cmd3"

share|improve this question
add comment

3 Answers 3

up vote 4 down vote accepted
tmux new -d -s my-session 'echo window-1 pane-1; sleep 8' \; \
          split-window -d 'echo window-1 pane-2; sleep 6' \; down-pane \; \
            new-window -d 'echo window-2;        sleep 4' \; next-window \; \
                attach \;

The above is a running example of the general idea ... more here: How to run streamripper and mplayer in a split-screen X terminal, via a single script

share|improve this answer
add comment

With gnome-terminal it would be:

gnome-terminal --window -e 'cmd1' --tab -e 'cmd2' --tab -e 'cmd3'

Each tab will be closed after its command is finished.

share|improve this answer
    
@saeedn.. In my GNOME Terminal 2.30.2 (Ubuntu), there is no --window option. Instead, --tab is required. –  Peter.O Oct 16 '11 at 10:50
    
great as well , but i do prefer tmux this time ;-P –  warl0ck Oct 16 '11 at 10:52
add comment

If it's always the same configuration of programs, you can use a tool like teamocil.

You'll need to create with a configuration (e.g. ~/.teamocil/sample), which contains something like:

windows:
  - name: my-first-window
    root: ~/Projects/foo-www
    filters:
      before: "rvm use 1.9.2"
      after: "echo 'I am done initializing this split.'"
    splits:
      - cmd: "git status"
      - cmd: "bundle exec rails server --port 4000"
        width: 50
      - cmd:
          - sudo service memcached start
          - sudo service mongodb start
        height: 50

And then you can run: tmux new-session -d "teamocil sample" \; attach

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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