I want change the OS hostname but I do not want to restart for that.
I have edited the file sudo gedit /etc/hostname but it requires a restart to get implemented. How to avoid this?
|
I want change the OS hostname but I do not want to restart for that. I have edited the file |
||||
|
|
|
It's not too hard. Use the following command in a terminal:
This will set the hostname to your-new-name until you restart. After a restart your changes in /etc/hostname will be used. See
for further information. |
|||||||||||||
|
|
Changing the hostname or computer name in ubuntu without restart Edit /etc/hostname and change to the new value,
Edit /etc/hosts and change the old 127.0.1.1 line to your new hostname
Note : i have read it on a forum > Edit /etc/hosts and change the old 127.0.1.1 line to your new hostname (if you dont do this, you wont be able to use sudo anymore. If you hav e already done it, press ESC on the grub menu, choose recovery, and edit your host file to the correct settings) Now after a reboot, your hostname will be the new one you chose To change without a reboot, you can just use hostname.sh after you edit /etc/hostname. You must keep both your host names in /etc/hosts (127.0.0.1 newhost oldhost) until you execute the command below:
Note : Above command to make the change active. The hostname saved in this file (/etc/hostname) will be preserved on system reboot (and will be set using the same script we used hostname.sh). |
||||
|
|
Use the hostname command to temporarily do this:
|
|||