/etc/hosts best practices?

I have renamed my droplet from the default centos-s-2vcpu-blah to my FQDN, and I see that the PTR record was auto-created accordingly.

I see that my bash prompt is still: [bob@centos-s-2vcpu-blah ~]

So I look in /etc/hosts and I find this (excluding commented lines and those for IPv6, and where I have changed my FQDN to centos-s-2vcpu-blah centos-s-2vcpu-blah localhost.localdomain localhost localhost4.localdomain4 localhost4

Is it recommended to edit the first line to replace centos-s-2vcpu-blah above to my FQDN? Should I leave alone the 2nd and 3rd lines? If I do edit the first line to my FQDN, will my bash prompt change to show my FQDN?

Or do the entries not really matter? And I can set it to whatever I like my bash prompt to say purely for the purpose of identifying to myself which Putty window is which, if I have a Putty window open to each of my many droplets.


Submit an answer
You can type!ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

You’re best off to run the hostname command as root (check hostname -h for full command). Give the droplet a reboot, if the /etc/hosts still has old entries, then give it an edit.