The extra hostname comes from a DNS .in-addr.arpa IP address lookup (often called 'reverse DNS', that maps IP addresses to hostnames). Or perhaps /etc/hosts
.
From man hostname
:
-A, --all-fqdns
Displays all FQDNs of the machine. This option enumerates all
configured network addresses on all configured network interfaces, and translates them to DNS domain names. Addresses that cannot be translated (i.e. because they do not have an appropriate reverse IP entry) are skipped. Note that different addresses may resolve to the same name, therefore the output may contain duplicate entries. Do not make any assumptions about the order of the output.
Note especially the phrase This option enumerates all
configured network addresses on all configured network interfaces
So, to find out where notmyhostname.notmydomain.com
is coming from, generate a list of all IP addresses on all interfaces, and do a reverse-DNS lookup on each of them:
ip addr | awk '/inet/ {gsub(/\/.*/,"") ; print $2}' | xargs -n 1 host
This will do lookups for ipv6 as well as ipv4 addresses. If you want only ipv4, add a space after 'inet', e.g.
awk '/inet / ...' ...
BTW, most likely it's your ISP or hosting provider (or their upstream) or whoever owns the .in-addr.arpa
or .ip6.arpa
domain for your IP subnet. They will have added a reverse-DNS entry for your IP.