Tmux: Start multiple tabs in 1 command
One thing I usually do when I start developing the web is
- open frontend
- open backend
- run frontend app
- 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
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 !