nerdexam
CompTIACompTIA

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.

System Management

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 localhost option is used to operate on a remote host (or localhost if specified), and the syntax hostnamectl -H localhost tempname is not the correct command structure for setting a hostname.
  • C. hostnamectl set-hostname tempname without any additional flags typically sets the static hostname, which would persist across reboots, contrary to the temporary requirement.
  • D. The hostnamectl set-hostname --static tempname command 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

#Linux administration#Hostname management#hostnamectl command#System configuration

Community Discussion

No community discussion yet for this question.

Full XK0-005 PracticeBrowse All XK0-005 Questions