On Ubuntu:
1. Press Ctrl+Alt+T on keyboard to open the terminal. When it opens, run the below command:
1. Press Ctrl+Alt+T on keyboard to open the terminal. When it opens, run the below command:
hostname NEW_NAME_HERE
This will change the hostname until next reboot. The change won’t be visible immediately in your current terminal. Start a new terminal to see the new hostname.
2. To change the name permanently, run command to edit the host files and change the name.And restart the machine after that:
sudo gedit /etc/hostname /etc/hostsReference
One more approach working on CentOS: Reference
In addition to hostname command you can also use hostnamectl command to display a Linux machine hostname.
In order to apply the new hostname, a system reboot is required, issue one of the below commands in order to reboot a CentOS 7 machine.
No comments:
Post a Comment