How to create a new session in tmux
Start a new named session:
Always name your sessions
A bare tmux gives you sessions named 0, 1, 2 — impossible to tell apart in a week. Names make tmux attach -t work and the prefix s picker actually useful.
The one command to remember
tmux new -As work attaches to "work" if it exists and creates it if it doesn't — idempotent, script-safe, and the best thing to put in your SSH workflow:
~/.tmux.conf
tmux new -As mainFrom inside tmux
Running tmux new inside tmux fails with "sessions should be nested with care". You don't want nesting — you want a new session on the same server: prefix : then new-session -s name, or from the shell tmux new -d -s name then switch with prefix s.
Related
Verified against tmux 3.6 · updated July 2026 · back to the full cheat sheet