hostname(1)

hostname1

Set or print name of current host system

Usage

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

Overview

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:

-s

Trims off any domain information from the printed name.

Releases

61 releases since OpenBSD 2.1; the text changed 14 times.

  1. 2.1
  2. 2.2–2.3
  3. 2.4
  4. 2.5
  5. 2.6
  6. 2.7–2.8
  7. 2.9
  8. 3.0–3.1
  9. 3.2–3.3
  10. 3.4
  11. 3.5–4.1
  12. 4.2–4.6
  13. 4.7–4.8
  14. 4.9–7.5
  15. 7.6–8.0

History

The hostname utility appeared in 4.2BSD.

From man 8.0-current-20261101 in OpenBSD 8.0-current (2026-11-01). Parsed by carta from the page's mdoc source.