Create a new tmux session named build.
Start long-task without attaching a client.
Which command is appropriate?
tmux new-session -d -s NAME COMMAND creates a named session in detached mode and starts the command in it.
Detailed explanation
tmux attach-session -t build long-taskIncorrect. attach-session connects to an existing session and does not create the detached one.
Incorrect. attach-session connects to an existing session and does not create the detached one.
tmux list-sessions -t buildIncorrect. list-sessions reports sessions rather than creating or starting a command.
Incorrect. list-sessions reports sessions rather than creating or starting a command.
tmux kill-session -t buildIncorrect. kill-session removes a session.
Incorrect. kill-session removes a session.
tmux new-session -d -s build long-taskCorrect. It creates build detached and runs long-task.
Correct. It creates build detached and runs long-task.
Try it yourself
An example you can run in a temporary verification environment.
tmux -VExpected result
tmuxとVersion番号(導入環境のみ)Key points
- new-session creates a session
- -d means detached
- -s sets the name
Notes
- Environment: tmux 3.x
- 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.