Skip to content

How to Change hostname with hostnamectl

Steps to Change Hostname for Linux

One-time Change

Side effect, ineffective after reboot

hostname {NEW host name}

Permanently Change

1 revise /etc/hosts

127.0.0.1  localhost  {NEW host name}

2 revise /etc/sysconfig/network

HOSTNAME={NEW host name}

Using hostnamectl

hostnamectl set-hostname NAME

Conclusion

Changing the hostname for Linux is a straightforward process that can be done in a few simple steps. By following the steps outlined in this blog post, you can easily change the hostname of your Linux system.

Some of the content is generated by AI, please be cautious in identifying it.

Leave Your Message