I use tmux to start multiple cmd at once

The Brown BoxThe Brown Box
1 min read

If you like me, you have to open multiple terminals to start number of services (in my case 5,6 services)

You gonna need to go to each folder and run some command.

So I look for some solution to make this easy and faster, I found tmux

tmux new-session \; \
  send-keys 'cd ~/Work/Sources/customer-root && npm run start' C-m \; \
  split-window -h \; \
  send-keys 'cd ~/Work/Sources/customer-common && npm run serve' C-m \; \
  split-window -v \; \
  send-keys 'cd ~/Work/Sources/customer-dashboard && npm run start' C-m \; \
  split-window -h \; \
  send-keys 'cd ~/Work/Sources/customer-main && npm run start' C-m \; \
  split-window -v \; \
  send-keys 'cd ~/Work/Sources/customer-auth && npm run start' C-m \; \
  select-layout tiled \; \
  send-keys 'cd ~/Work/Sources/customer-root && npm run start' C-m \; \

add this to and .sh file then you’re good to go with a single command

Change between windows by: ctl+b+o

0
Subscribe to my newsletter

Read articles from The Brown Box directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

The Brown Box
The Brown Box