A Linux system administrator wants to assign a user-friendly name, "Corporate Web Server", to a machine. This name should be displayed in user interface elements but should not alter the static hostname used for network communication. Which of the following commands correctly sets only the "pretty" hostname?
hostnamectl set-hostname "Corporate Web Server"
hostnamectl --set-pretty-hostname "Corporate Web Server"
hostnamectl set-location "Corporate Web Server"
hostnamectl set-hostname "Corporate Web Server" --pretty
The correct command is hostnamectl set-hostname "Corporate Web Server" --pretty. The hostnamectl command is used to manage system hostnames. By default, hostnamectl set-hostname NAME changes the static, transient, and pretty hostnames. To change only the pretty hostname, which is a free-form UTF-8 string for display purposes, the --pretty flag must be used. The command hostnamectl set-hostname "Corporate Web Server" would incorrectly change all three hostname types. The command hostnamectl set-location is used to describe the physical location of the server, not its user-facing name. The syntax hostnamectl --set-pretty-hostname is incorrect as --set-pretty-hostname is not a valid option for the command.
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 are the different types of hostnames in Linux?
Open an interactive chat with Bash
What does the `--pretty` option do in the hostnamectl command?
Open an interactive chat with Bash
What is the default behavior of the `hostnamectl set-hostname` command?
Open an interactive chat with Bash
CompTIA Linux+ XK0-006 (V8)
Services and User Management
Your Score:
Report Issue
Bash, the Crucial Exams Chat Bot
AI Bot
Loading...
Loading...
Loading...
IT & Cybersecurity Package Join Premium for Full Access