I have a machine I changed the hostname of. I changed it in
/etc/sysconfig/network, and with
hostname returns the correct shortname,
hostname --fqdn returns the expected FQDN, but
hostname -A returns an old name. I changed the IP address of the machine to make sure it wasn't external DNS cache.
If I open python and run
import socket print(socket.gethostname()) print(socket.getfqdn())
Both return the old hostname/fqdn, the same as
From the hostname man page it appears
--fqdn just takes the shortname and domain and puts them together.
Display the FQDN (Fully Qualified Domain Name). A FQDN consists of a short host name and the DNS domain name. Unless you are using bind or NIS for host lookups you can change the FQDN and the DNS domain name (which is part of the FQDN) in the /etc/hosts file.
What is the difference between these commands and how can I better troubleshoot why the old hostname is sticking around.