How to use ypdomainname command.

In the realm of Linux networking, the ypdomainname command plays a crucial role in the context of the Network Information Service (NIS). NIS, formerly known as Yellow Pages, is a distributed database service that facilitates the sharing of network configuration and user information across multiple systems in a network.

Purpose of ypdomainname:

The primary purpose of ypdomainname is to display or set the NIS domain name on a Linux system. The NIS domain name is a key component that allows systems to identify and communicate with each other in a networked environment.

Displaying the NIS Domain Name:

To view the currently configured NIS domain name, use the following command:


This will output the current NIS domain name set on the system.

Setting the NIS Domain Name:

To set or change the NIS domain name, use the following command:

ypdomainname <domain_name>

Replace <domain_name> with the desired NIS domain name. This command modifies the system’s configuration to use the specified NIS domain.

Practical Examples:

Example 1: Displaying the Current NIS Domain Name

$ ypdomainname

In this example, the current NIS domain name is shown as "exampledomain."

Example 2: Setting a New NIS Domain Name

$ ypdomainname newdomain
$ ypdomainname

In this example, the NIS domain name is changed to "newdomain," and the subsequent ypdomainname command confirms the modification.

Example 3: Verifying NIS Domain Name in Configuration Files

The NIS domain name is typically stored in the /etc/defaultdomain file. Let’s confirm this using the cat command:

$ cat /etc/defaultdomain newdomain

This shows that the NIS domain name is persistently configured as "newdomain" in the system.

Important Considerations:

  1. NIS Usage Status: While ypdomainname is a valid command, it’s essential to note that NIS is considered outdated in modern Linux environments. Alternatives such as LDAP or NIS-compatible services are often preferred for managing network information.

  2. Network Information Service Alternatives: As an alternative to NIS, Linux distributions commonly use Lightweight Directory Access Protocol (LDAP) for centralized authentication and directory services. System administrators are encouraged to explore modern solutions based on their network requirements.


In summary, the ypdomainname command in Linux is a tool for managing the Network Information Service domain name. While it provides a simple way to view and modify the NIS domain, users are encouraged to explore contemporary alternatives for network information management.

Leave A Comment

What’s happening in your mind about this post !

Your email address will not be published. Required fields are marked *