CLI Tools bash Intermediate

Tmux Session Manager

Script that creates or attaches to a named tmux session with predefined window layout.

bash
#!/bin/bash
SESSION=dev
tmux has-session -t $SESSION 2>/dev/null
if [ $? != 0 ]; then
  tmux new-session  -d -s $SESSION -n editor
  tmux send-keys    -t $SESSION:editor 'nvim .' Enter
  tmux new-window   -t $SESSION -n server
  tmux send-keys    -t $SESSION:server 'npm run dev' Enter
fi
tmux attach-session -t $SESSION

Prerequisites

  • tmux >= 3

Pro Tips

  • → Store in ~/bin/dev and make executable.

Was this module useful?

Share your experience — it helps the team improve.

Leave Feedback

Commercial Licensing

Acquire a production access token or template license for enterprise deployment.

Module Info

Language
bash
Level
Intermediate
Read time
2 min
Published
May 2025
License
Commercial License

Newsletter

New modules every week, directly to your inbox.