tmux always reattach

Posted on

Really small tip here:

I’ve switched to tmux recently and was always wondering why the default behaviour was to always create a new session. I’ve understood that it’s usable but it was hindering my workflow coming from screen. Whatever… I came up with a small alias which works very well for me:

alias tmux='tmux attach || tmux'

This alias always reattaches me to any existing session, but if none exists yet, creates a new one. Always the right behaviour for me, does it fit your needs too?

Cheers,
@kjellski

Leave a Reply

Your email address will not be published.