XK0-005 · Question #1347
XK0-005 Question #1347: Real Exam Question with Answer & Explanation
The correct answer is A: Hostnamet1 set-hostname -transient tempname. To temporarily change a Linux hostname so that it automatically reverts to its original name after a reboot, the hostnamectl set-hostname --transient command is the appropriate choice.
Question
A Linux administrator is testing a configuration script and wants to change the hostname of a workstation temporarily, but it must return to its assigned workstation name after reboot. Which of the following is the BEST command for the administrator to use?
Options
- AHostnamet1 set-hostname -transient tempname
- BHostnamect1 -H localhost tempname
- CHostnamect1 set-hostname tempname
- DHostnamect1 set-hostname -static tempname
Explanation
To temporarily change a Linux hostname so that it automatically reverts to its original name after a reboot, the hostnamectl set-hostname --transient command is the appropriate choice.
Common mistakes.
- B. The
-H localhostoption is used to operate on a remote host (or localhost if specified), and the syntaxhostnamectl -H localhost tempnameis not the correct command structure for setting a hostname. - C.
hostnamectl set-hostname tempnamewithout any additional flags typically sets the static hostname, which would persist across reboots, contrary to the temporary requirement. - D. The
hostnamectl set-hostname --static tempnamecommand explicitly sets the static hostname, which is designed to persist permanently across reboots and would not revert to the original name.
Concept tested. Linux hostname management (hostnamectl)
Reference. https://www.freedesktop.org/software/systemd/man/hostnamectl.html
Topics
Community Discussion
No community discussion yet for this question.