Skip to content

How to change Linux hostname

Here are some methods to change hostname for a certain Linux system.

homepage-banner

Introduction

In Linux, the hostname is a label assigned to a device connected to a computer network. It is used to identify the device on the network. The hostname is an important aspect of the Linux operating system because it is used by many system services to identify the device. In this blog post, we will discuss how to change the hostname for Linux.

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.

Leave a message