Set the systemd host's persistent static hostname to node1.example.test.
Which command is appropriate?
hostnamectl set-hostname sets the static hostname and normally persists it in /etc/hostname.
Detailed explanation
hostnamectl set-hostname node1.example.testCorrect. It sets the persistent hostname.
Correct. It sets the persistent hostname.
hostnamectl status node1.example.testIncorrect. status only displays information.
Incorrect. status only displays information.
hostnamectl set-chassis node1.example.testIncorrect. set-chassis changes chassis metadata.
Incorrect. set-chassis changes chassis metadata.
hostnamectl reboot node1.example.testIncorrect. There is no hostname-setting reboot subcommand.
Incorrect. There is no hostname-setting reboot subcommand.
Try it yourself
An example you can run in a temporary verification environment.
hostnamectl --help | grep -F 'set-hostname' | head -n 1Expected result
set-hostname NAMEのhelp行Key points
- set-hostname
- Static hostname
- status is read-only
Notes
- Environment: systemd hostnamectl help(読取のみ)
- 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.