tags:

views:

62

answers:

1

I'm switching from using gnu-screen to tmux, and I'm still trying to wrap my head around changes.

One thing I'd like to be able to do is start tmux and have it automatically connect to a session if one exists, and otherwise create a new session.

  • tmux attach attaches to an automatically existing session - but errors out if no session exists
  • tmux new creates a new session - but it does so every time, so I can't leave it in my .tmux.conf
  • tmux has-session tests whether a session exists - but I don't know how to stitch it together with the other commands

Can anyone give me some configure file advice?

A: 

I figured it out (and had it pointed out to me).

tmux attach || tmux new
rampion