---
name: "domainname"
section: "1"
platform: "openbsd"
package: "man"
version: "8.0-current-20261101"
release: "OpenBSD 8.0-current (2026-11-01)"
platforms: ["linux", "freebsd", "openbsd"]
url: "https://new.carta.tech/domainname"
---

# domainname(1)

set or print YP domain of current host system

## NAME

**domainname** – set or print YP domain of current host system

## SYNOPSIS

**domainname** \[*name-of-domain*\]

## DESCRIPTION

The **domainname** utility prints the YP domain name of the current host. The superuser can set the domain name by supplying a */etc/defaultdomain* file (see [defaultdomain(5)](/defaultdomain/5.md)). This is used at system boot time by [rc(8)](/rc/8.md) to initialize the domainname.

## SEE ALSO

[hostname(1)](/hostname/1.md), [getdomainname(3)](/getdomainname/3.md), [setdomainname(3)](/setdomainname/3.md), [defaultdomain(5)](/defaultdomain/5.md), [rc(8)](/rc/8.md), [yp(8)](/yp/8.md)

## HISTORY

The **domainname** utility is derived from the [hostname(1)](/hostname/1.md) utility, which appeared in 4.2BSD. The **domainname** utility appeared in NetBSD 0.8.
