Create a GNU screen session named build.
Run long-task inside it in a detached state from the start.
Which command is correct?
screen -dmS NAME COMMAND creates a named session, starts the command, and leaves the session detached.
Detailed explanation
screen -r build long-taskIncorrect. -r reconnects to an existing session and is not the detached creation form.
Incorrect. -r reconnects to an existing session and is not the detached creation form.
screen -ls build long-taskIncorrect. -ls lists sessions and does not start the requested command.
Incorrect. -ls lists sessions and does not start the requested command.
screen -dmS build long-taskCorrect. It creates build detached and starts long-task inside it.
Correct. It creates build detached and starts long-task inside it.
screen -X build long-taskIncorrect. -X sends a screen command to an existing session and is missing the creation mode.
Incorrect. -X sends a screen command to an existing session and is missing the creation mode.
Try it yourself
An example you can run in a temporary verification environment.
screen --versionExpected result
Screen versionを含むVersion情報(導入環境のみ)Key points
- -d -m starts detached
- -S sets the session name
- -r reconnects to a session
Notes
- Environment: GNU screen 4.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.