nerdexam
IBM

000-221 · Question #109

Two different administrators are asked to change the hostname of a system due to a misunderstanding The current hostname is set to misunderstanding. The current hostname is set to 'ozi'. The first…

The correct answer is C. The output of both commands will be 'ozi' after reboot. Both the hostname and uname -S commands only change the kernel hostname in memory temporarily and do not persist across a system reboot.

System Management

Question

Two different administrators are asked to change the hostname of a system due to a misunderstanding The current hostname is set to misunderstanding. The current hostname is set to 'ozi'. The first administrator thinks the hostname should be set to 'kiwi' and he runs the command:

hostname kiwi He checks his work by running the hostname command again and he sees this output # hostname kiwi The second administrator thinks the hostname should be 'texan' and he runs the command:

uname -S texan He checks his work by running uname -n and sees the output # uname -n texan What will be the output of the hostname and uname -n command when the system reboots?

Options

  • AThe output of both commands will be 'kiwi' after reboot.
  • BThe output of both commands will be 'texan' after reboot.
  • CThe output of both commands will be 'ozi' after reboot.
  • DThe output of the hostname command will be 'kiwi' and the output of the uname -n command will be texan".

How the community answered

(20 responses)
  • A
    5% (1)
  • B
    5% (1)
  • C
    80% (16)
  • D
    10% (2)

Why each option

Both the hostname and uname -S commands only change the kernel hostname in memory temporarily and do not persist across a system reboot.

AThe output of both commands will be 'kiwi' after reboot.

The hostname kiwi command only sets the hostname in volatile memory and does not write to any persistent configuration file, so 'kiwi' will not survive a reboot.

BThe output of both commands will be 'texan' after reboot.

The uname -S texan command similarly only modifies the in-memory kernel hostname and does not persist the value to disk, so 'texan' will not be present after rebooting.

CThe output of both commands will be 'ozi' after reboot.Correct

The hostname command and uname -S command both invoke the sethostname() system call, which modifies the running kernel hostname in memory only, without writing to any persistent configuration file. On reboot, the system reads the hostname from its stored configuration (such as /etc/hostname), which was never changed and still contains 'ozi'. Therefore both commands will output 'ozi' after the system restarts.

DThe output of the hostname command will be 'kiwi' and the output of the uname -n command will be texan".

Both hostname and uname -S operate on the same single kernel hostname value and do not maintain separate independent values, and neither change is stored persistently.

Concept tested: Temporary vs persistent hostname configuration in Linux

Source: https://man7.org/linux/man-pages/man1/hostname.1.html

Topics

#hostname persistence#uname -S#ODM#reboot behavior

Community Discussion

No community discussion yet for this question.

Full 000-221 Practice