start a new session with the name mysession and window mywindow

windows

// what it does

`tmux new` (alias for new-session) starts a fresh session and immediately attaches to it. `-s mysession` sets the session name so you can target or reattach it later (`tmux attach -t mysession`) instead of relying on the default numeric index. `-n mywindow` names the first window rather than letting automatic-rename label it after the running command. Reach for this when spinning up a named workspace you plan to detach from and return to.

// shell

$ tmux new -s mysession -n mywindow

// gotcha

If a session named mysession already exists, tmux aborts with "duplicate session: mysession" instead of attaching — use `tmux attach -t mysession` or `tmux new -A -s mysession` to reuse it.