A system administrator needs to permanently change the hostname on a Linux server to 'server-prod'. They decide to directly edit the necessary file to apply the hostname change across reboots. Which file should the administrator edit to achieve this?
The correct file to edit in order to permanently change the hostname on a Linux system is /etc/hostname. This file contains the system's hostname, which is read at boot time and sets the system's hostname for the duration of the session. Other options provided are close, but they serve different purposes: /etc/hosts is used for static IP to hostname mappings, and while /etc/hostname.conf and /etc/sysconfig/hostname look like they might be related to hostname configuration, they are not standard files for setting the hostname on most Linux distributions.
Ask Bash
Bash is our AI bot, trained to help you pass your exam. AI Generated Content may display inaccurate information, always double-check anything important.
What is the purpose of the /etc/hostname file?
Open an interactive chat with Bash
How does the /etc/hosts file relate to system hostnames?
Open an interactive chat with Bash
Are /etc/hostname.conf and /etc/sysconfig/hostname commonly used in Linux?