Skip to main content

Hostname Usage

The hostname command can be used to identify your nodes.

To get IP addresses use the following command:

hostname -I

To set the hostname use the following command:

sudo hostname NEW_HOSTNAME

Or, to permanently set the hostname:

You can use:

sudo hostnamectl set-hostname NEW_HOSTNAME

Or, you can use:

sudo nano /etc/hostname

And change the hostname to the desired value. Then you'll need to reboot your node for the changes to take effect.

To set the hostname from a file use the following command:

sudo hostname -F ~/hostname.txt

Note: The file contents of ~/hostname.txt should be the hostname.

To get all of the fully qualified domain names for your nodes use the following command:

hostname -A