HOSTNAME(1) General Commands Manual HOSTNAME(1)

NAME

hostnameset or print name of current host system

SYNOPSIS

hostname [-AadfIis] [name-of-host]

DESCRIPTION

hostname prints the name of the current host. The super-user can set the host name by supplying an argument; this is usually done in the network initialization script /etc/rc.d/network, normally run at boot time.

Options:

-A
Display the FQDN of each address on all interfaces.
-a
Display alias name(s) of the host.
-d
Display the DNS domain.
-f
Display the FQDN for the hostname.
-I
Display each IP address on all interfaces.
-i
Display the IP address(es) for the hostname.
-s
Display the short hostname.

NOTES

With the exception of -I and -s, the other options will retrieve their results from the resolver.

SEE ALSO

domainname(1), getaddrinfo(3), gethostbyname(3), gethostname(3), getifaddrs(3), getnameinfo(3), sethostname(3), hosts(5)

HISTORY

The hostname utility appeared in 4.2BSD.
July 19, 2013 NetBSD 6.99