Session ManagementN/A (run from shell)
attach-session
Short form: attach, a
Attach to an existing session. If no session is specified, attach to the most recently used session. If no sessions exist, an error is reported.
Synopsis
bash
tmux attach-session [-dErx] [-c working-directory] [-f flags] [-t target-session]Options
| Flag | Description |
|---|---|
| -d | Detach any other clients attached to the session |
| -r | Attach in read-only mode |
| -t target-session | Specify which session to attach to |
| -c working-directory | Set the working directory for the attached client |
Examples
Attach to most recent session
bash
tmux attachShort form - attach to most recent session
bash
tmux aAttach to session named 'dev'
bash
tmux attach -t devAttach to session number 0
bash
tmux a -t 0Attach and detach all other clients
bash
tmux attach -d -t mainAttach in read-only mode (observer)
bash
tmux attach -r -t sharedDefault Keybinding
N/A (run from shell)
Default prefix is Ctrl+b
Pro Tips
- •Use 'tmux a' as a quick shorthand for attaching
- •The -d flag is useful for taking over a session from another machine
- •Read-only mode (-r) is perfect for pair programming or demos