You don't need to do anything, since you've already changed the hostname by editing /etc/hostname
. If you're trying to do something other than change the hostname as the host knows it, please elaborate.
/etc/hosts
just lists symbolic names for IPs, so that for example ping localhost
does the same as ping 127.0.0.1
if you have a line starting with 127.0.0.1
and localhost
somewhere else on the line (whitespace separated). You can of course add abcd
to that line, but that has nothing to do with the hostname in /etc/hostname
, other than that they coincidentally are the same string. You can't for example enter localhost abcd
in the file and expect that to resolve abcd → localhost → 127.0.0.1.
PS: DNS names are not case sensitive, but are conventionally written in lowercase.