Sessions run in the background and can be detached and reattached. A session contains windows and persists even when you disconnect. This is useful for remote work—if your SSH connection drops, your session is still running.
$ tmux # create a new unnamed session $ tmux new-session -s work # create named session $ tmux list-sessions # list all sessions $ tmux attach -t work # attach to session "work" $ tmux attach # attach to most recent session $ tmux kill-session -t work # kill session "work"
Within a session, use these key bindings (prefix is Ctrl+B by default):
Ctrl+B d detach from current session Ctrl+B ( switch to previous session Ctrl+B ) switch to next session Ctrl+B s choose session interactively Ctrl+B $ rename current session Ctrl+B :kill-session kill current session
Each session is independent—windows and panes in one session don't affect others. Sessions survive terminal window closure and SSH disconnection, making them perfect for long-running work.