Change HostName From Command Line Linux

To change the  hostname, follow the steps shown below.

1. Use hostname command to Change Hostname

In this example, we’ll change the hostname from dev-server to prod-server.

hostname command by default will display the current hostname as shown below:

# hostname
dev-server

The following will change the hostname to prod-server.

# hostname prod-server

Once the hostname is changed, verify that it has changed the hostname successfully. As you see below, it has changed the hostname to prod-server

# hostname
prod-server

Related Posts

  • 94
    > check the current hostname login on server as root user run the command: hostname > change the hostname: hostname newname
    Tags: hostname, change
  • 45
    Hi, I have just changed the permission of wp-content folder to 777. After change the permission not able to see the captcha image.      
    Tags: change
  • 38
    If you omit the ENGINE option, the default storage engine is used. Normally, this is MyISAM, but you can change it by using the --default-storage-engine server startup option, or by setting the default-storage-engine option in the my.cnf configuration file. You may also want to change the default storage engine just for the current session. You can do this…
    Tags: change
  • 34
    You'll need to: Stop Asterisk Stop DAHDI Unload the driver for your card from the Linux kernel Load the driver for your card with the module parameter "vpmsupport=0". You can stop Asterisk with the command: asterisk -rx "core stop gracefully" You can stop DAHDI with the command: /etc/init.d/dahdi stop In…
    Tags: change

One thought on “Change HostName From Command Line Linux

  • September 25, 2014 at 4:22 am
    Permalink

    Update /etc/hosts

    Now, you need to edit /etc/hosts file, enteR:

    vi /etc/hosts

    Reply

Leave a Reply

Your email address will not be published. Required fields are marked *

%d bloggers like this: