Tmux: Start multiple tabs in 1 command

Jul 13, 2023

One thing I usually do when I start developing the web is

  1. open frontend
  2. open backend
  3. run frontend app
  4. run backend app

This is time consuming and I would rather write on script to do it.

Here is the script

file: myapp.tmuxnew-session myapp
rename-session myapp
rename-window myapp
send "cd ~/development/myapp-frontend && yarn local" C-m
split-window -h
send "cd ~/development/myapp-backend && yarn local" C-m
split-window -v
send "cd ~/development/myapp-backend" C-m
select-pane -t 0
split-window -v
send "cd ~/development/myapp-frontend" C-m

This can be open with tmux by the command

$ tmux source-file myapp.tmux

Hope this help !

TeamCMD

We are CODEMONDAY team and provide a variety of content about Business , technology, and Programming. Let's enjoy it with us.