2

Tmux supports creating sessions, and with the -A flag attaching to session if they already exist rather than creating them. But, if they don't exist and tmux has to create them, what's the best way to supply the information needed to initialize them while retaining the ability to simply attach if a session by the same name already exists.

2

The -A flag takes a command argument that only runs if the session is not initialized,

tmux new-session -A -s com "irssi"

For example that will either

  • Attach to a session named com
  • Create a session called com and start up irssi in that session.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.