HOSTNAME(1) BSD Reference Manual HOSTNAME(1)
hostname - set or print name of current host system
hostname [-fs] [name-of-host]
The hostname utility prints the name of the current host. The superuser can set the host name by supplying a /etc/myname file. This is used at system boot time by netstart(8) to initialise the hostname. The options are as follows: -f Returns what the DNS resolver thinks the hostname canonicalises to. This is usually the "official host name" of the first line in /etc/hosts whose official host name or alias matches the name of the current host, but can also be retrieved from DNS. -s Trims off any domain information from the printed name.
/etc/hosts The host name database. /etc/myname Configuration file containing the fully qualified host name (FQDN), to be set at system boot time.
getaddrinfo(3), gethostname(3), sethostname(3), hosts(5), myname(5), hostname(7), netstart(8)
The hostname utility appeared in 4.2BSD. The -f option appeared in MirBSD #11, inspired by the GNU version of hostname. MirBSD #10-current January 24, 2021 1