HOSTNAME(1) General Commands Manual HOSTNAME(1)

hostnameset or print name of current host system

hostname [-s] [name-of-host]

The hostname utility is used to set or print the name of the current host. If no argument is given, the name of the current host is printed.

The host name can be set by the superuser either by specifying name-of-host, or by supplying a myname(5) file, which is used at system boot time by rc(8) to initialize the hostname.

The options are as follows:

Trims off any domain information from the printed name.

domainname(1), gethostname(3), myname(5), hostname(7), rc(8)

The hostname utility appeared in 4.2BSD.

August 25, 2024 OpenBSD 7.6