How to change “HOSTNAME” Permanently and Temporary in Linux

In the computer world, we assigned a name for computer as we do for humans. This is called hostname. So in this article I’m going to show you how to Change Hostname in Linux / Unix operating system. it’s very simple. we have two ways to do this job.

Change Hostname in Linux

1. Permanent way: (after change we have need to restart to the system)

2. Temporary way: (temporary way effect immediately and when you reboot your system the changes are removed as default)

NOTE:-Before applying changes, you must check your current hostname using the “hostname” command. Hostname command shows you the present hostname of your system.

Permanently

1. Permanent way:- Change hostname, edit your network file using below command.

#vi /etc/sysconfig/network

HOSTNAME=NEW_HOSTNAME.COM (give HOSTNAME WHICH IS YOU WANT TO SET)

Then save the file and exit, Now reboot your system then you check your hostname, it’s changed permanently.

#hostname (to check your current hostname)

Temporary

2. Temporary way:- you can use “hostname” command to change existing hostname for temporary.

#hostname ocptechnology.com (your new hostname)

Then check

#hostname (to check your current hostname)

ReadHow to configure yum server

Connect with me on:

Instagram: https://www.instagram.com/shripaldba
Linkedin: 
https://www.linkedin.com/in/shripal-singh
Twitter: 
https://twitter.com/ocptechnology
Facebook: 
https://www.facebook.com/ocptechnology
YouTube:
https://www.youtube.com/ocptechnology

Leave a Comment

%d bloggers like this:
Enable Notifications    OK No thanks