---
name: "domainname"
section: "1"
platform: "freebsd"
package: "base"
version: "16.0-CURRENT-20261027-61c70dc16a79"
release: "FreeBSD 16.0-CURRENT (2026-10-27)"
platforms: ["linux", "freebsd", "openbsd"]
url: "https://new.carta.tech/domainname"
---

# domainname(1)

set or print name of current YP/NIS domain

## NAME

**domainname** – set or print name of current YP/NIS domain

## SYNOPSIS

**domainname** \[*ypdomain*\]

## DESCRIPTION

The **domainname** utility prints the name of the current YP/NIS domain. The super-user can set the domain name by supplying an argument; this is usually done with the *nisdomainname* variable in the */etc/rc.conf* file, normally runs at boot time.

## NOTES

The YP/NIS (formerly \`\`Yellow Pages'' but renamed for legal reasons) domain name does not necessarily have anything to do with the Domain Name System domain name, although they are often set equal for administrative convenience.

## SEE ALSO

[getdomainname(3)](/getdomainname/3.md), [rc.conf(5)](/rc.conf/5.md)

## HISTORY

The **domainname** command appeared in FreeBSD 1.1, based on a similar command in SunOS.
