Forrest logo
back to the hostnamectl tool

hostnamectl:tldr:01d03

hostnamectl: Reset hostname to its default value.
$ sudo hostnamectl set-hostname --pretty ""
try on your machine

The command sudo hostnamectl set-hostname --pretty "" is used to change the pretty (readable) name of the system's hostname to an empty (blank) value.

Here is a breakdown of the command:

  • sudo: This command prefix is used to run the following command with administrative privileges. It may prompt the user to enter the root password or authenticate using their own credentials.

  • hostnamectl: This is a command-line utility in Linux used to control the system's hostname settings.

  • set-hostname: It is a subcommand of hostnamectl used to change the system's hostname.

  • --pretty: This option is used to set the pretty (human-readable) version of the hostname.

  • "": Within the quotation marks is the parameter value for --pretty. In this case, it is a blank (empty) value, indicating that no pretty name should be assigned.

Putting it all together, the command instructs the system to set the pretty name of the hostname to nothing, effectively removing any human-readable label associated with the hostname.

This explanation was created by an AI. In most cases those are correct. But please always be careful and never run a command you are not sure if it is safe.
back to the hostnamectl tool