tmux Multiple Sessions
tmux for multiple long-running sessions.
Create
tmux multiple sessions is the discipline of organizing terminal work into persistent named sessions. The discipline pays off for engineers running long operations, working across many remote servers, or maintaining context across SSH outages.
What creating sessions looks like:
- tmux new -s work creates a named session.: The -s flag names the session "work". Named sessions are easier to navigate than indexed; the team's mental model maps to names.
- Detach with Ctrl+B then d.: The detach key sequence leaves the session running but releases the terminal. The session continues; the engineer can re-attach later; commands keep running.
- Per-purpose sessions.: The team uses different sessions for different work. "monitoring" for dashboards; "deploys" for deployment work; "investigation" for incident response. The sessions stay organized.
- tmux new without arguments.: Creates an unnamed session. Some engineers prefer this; the engineer's preference shapes their tmux usage.
- Configuration in .tmux.conf.: The team's tmux configuration lives in ~/.tmux.conf. Custom keybindings, status bar configuration, color schemes all are configurable; the team's preferences are versioned.
Creating sessions is the foundation. Without it, terminal work is ephemeral; with it, work persists.
Attach
Attaching to existing sessions resumes the work. The session's state is preserved; the engineer continues where they left off.
- tmux attach -t work re-attaches.: The -t flag specifies which session to attach to. The session's history is visible; running commands continue; the engineer's context is restored.
- Multiple sessions.: The engineer can have many sessions. Each has its own purpose; switching between them is fast; the work organization scales.
- Switch via tmux ls.: The tmux ls command lists all sessions. The engineer sees what is running; chooses which to attach to; navigates the work.
- tmux switch-client.: Within a tmux session, switching to another session is fast. The engineer does not need to detach and re-attach; the keybinding navigates directly.
- tmux kill-session.: Sessions can be killed when no longer needed. The kill-session command removes the session; the resources are freed; the workspace stays organized.
Attaching is the resumption mechanism. The discipline is naming sessions clearly so reattachment is obvious.
Benefit
The benefits compound. Long-running commands survive disconnect; SSH outages do not lose work; the engineer's productivity is preserved.
- Long-running commands survive disconnect.: A command that runs for hours can survive the engineer disconnecting. The tmux session keeps it running; the engineer reattaches later; the result is preserved.
- Attaches preserve context across SSH outages.: SSH connections drop sometimes. With tmux, the work continues server-side; the engineer reattaches when connectivity returns; no work is lost.
- Multiple windows in a session.: tmux supports multiple windows within a session. Each window can be a different working context; switching between them is fast.
- Multiple panes in a window.: Beyond windows, panes split a single window. The engineer can run multiple commands simultaneously; output is visible; investigation is supported.
- Pair programming.: Multiple engineers can attach to the same session. The screens are shared; pair programming over SSH is supported; the discipline scales beyond solo work.
tmux multiple sessions is one of those terminal disciplines that pays off across many work patterns. Nova AI Ops integrates with infrastructure observability, complementing the local-tool perspective with cluster-wide visibility for systematic operations.