RHEL 8 Change Hostname (computer name) command

https:‮/‬/www.lautturi.com
RHEL 8 Change Hostname (computer name) command

To change the hostname (computer name) on a Red Hat Enterprise Linux (RHEL) 8 system, you can use the hostnamectl command.

To set the hostname to a new value, use the set-hostname option followed by the new hostname. For example:

sudo hostnamectl set-hostname myhostname

This will set the hostname to myhostname.

To view the current hostname, you can use the status option:

hostnamectl status

This will display the current hostname, as well as other system information.

Note that the changes made using the hostnamectl command are temporary and will not persist after a reboot. To make the hostname change permanent, you will need to edit the /etc/hostname file and set the hostname in this file.

sudo vi /etc/hostname

Change the hostname in this file to the desired hostname and save the file. The changes will take effect after a reboot.

Created Time:2017-10-30 14:27:13  Author:lautturi