In my alias list:
alias "tmux-attach-or-create-main-session=tmux new-session -A -s main"
Via User Wesley Baugh – Unix & Linux Stack Exchange who answered:
If naming your session is okay, then it’s easy to do with the new-session command:
tmux new-session -A -s main
where
main
is the session name that will be attached to or created if needed.From
man tmux
The -A flag makes new-session behave like attach-session if session-name already exists; in this case, -D behaves like -d to attach-session.
–jeroen
Source: How to start tmux with attach if a session exists – Unix & Linux Stack Exchange
Filed under: *nix, *nix-tools, Linux, openSuSE, Power User, SuSE Linux, tmux