How to change Hostname / Computer's name on Linux Cloud Servers

2020-08-11 By Sam 4914 Views linux hostname networking
6 reviews

A hostname is used to identify a server. The requirements for enabling computers to communicate with each other on a network using the concept of the hostname. Normally the hostname of a System/Server is used to make it easier to identify the host and it will reduce the difficulties to remember the IP address.


This article will guide you on how to change the hostname on Centos, Ubuntu & Debian servers.


To view the current hostname for the server by running the following command:

# hostname
or
# hostnamectl

hostnamelinux1

hostnamelinux2


To update the new hostname of the server using the following command:

Syntax:

# hostname new-serverhostname-name-here
or
# hostnamectl set-hostname new-serverhostname-name-here

hostnamelinux3

hostnamelinux4

NOTE: Replace new-serverhostname-name-here with your new hostname (E.g. server4857testing.com).


Once you have updated the hostname, use the following commands to view the new hostname:

# hostname
or
# hostnamectl

hostnamelinux5

hostnamelinux6


Related Tutorial

What do you think about this article?

Rate this article
LayerStack Promotion
Need assistance?

Try this guide to receive free bundled services at signup on a new free account.

Sign Up

Your Feedback Is Important

We hope you’ll give the new products and updates a try. If you have an idea for improving our products or want to vote on other user ideas so they get prioritized, please submit your feedback on our Community platform. And if you have any questions, please feel free to ask in the Community or contact our Technical Support team.