Changing hostname in Linux without rebooting, is quite straight forward. Changing the hostname will also change the name on the Terminal prompt, and will be displayed beside the current login user on the system.
Open a terminal window and edit /etc/hostname. Use vi, nano or even echo command to change the content or value of the hostname file.
Then type this:
sysctl kernel.hostname=new-hostname-office.internal
After typing the command, if the new hostname doesn't appear yet. Disconnect from SSH and login again via SSH and the new name will be displayed.
That's it, simple as that.
If unsure, try on a VM before applying to production. And check whether the desired output is the expected result.
Cheers! Till next time.
Do ASAP, Always Say A Prayer...
Practice O.T.G. = Obedience To God
Make time for Prayer and Meditation.
Take time to kneel down and Pray!
Practice F.IF.T.H (Firm In Faith Towards Heaven)
Your attitude will depends your altitude, stay humble!
Comments
Post a Comment