Detach the tmux session maint with Ctrl+B, D.
Reconnect to the same session after logging in again.
Which command is appropriate?
tmux attach -t maint attaches to an existing session; detaching does not terminate the session or its processes.
Detailed explanation
tmux new -s maintIncorrect. new creates a new session instead of attaching to maint.
Incorrect. new creates a new session instead of attaching to maint.
tmux list-windows -t maintIncorrect. list-windows displays windows but does not attach the client.
Incorrect. list-windows displays windows but does not attach the client.
tmux attach -t maintCorrect. tmux attach -t maint reconnects to the existing session.
Correct. tmux attach -t maint reconnects to the existing session.
tmux kill-session -t maintIncorrect. kill-session terminates the session.
Incorrect. kill-session terminates the session.
Try it yourself
An example you can run in a temporary verification environment.
tmux -V 2>/dev/null || trueExpected result
tmuxがあればversion。serverやsessionは起動しないKey points
- tmux attach
- -t
- Session persistence
Notes
- Environment: tmux version確認のみ
- Command output formatting can vary slightly by distribution or tool version.
- Run the example in a temporary directory or process when possible.
Foundation review
Read the scope first
Check whether the command acts on the current shell, a new process, an existing process, or a file.
Verify the observable result
Use the supplied command and compare the output with the expected result.