Tmux: Start multiple tabs in 1 command

tanut aran
Jan 15, 2021

--

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 !

--

--

tanut aran
tanut aran

Written by tanut aran

Co-founder and Coder at work !

No responses yet