「分かりそう」で「分からない」でも「分かった」気になれるIT用語辞典イメージぴよ画像「分かりそう」で「分からない」でも「分かった」気になれるIT用語辞典

ypdomainname【コマンド】

pointこの用語のポイント

pointコマンドだよ

pointUNIX系で使えるよ

pointNISドメイン名を表示・設定するよ

point実質的に「hostname」コマンドと同じだよ

スポンサーリンク

簡単に書くよ

ypdomainname【コマンド】とは

コンピュータさんに対する命令文(コマンド)のひとつ
であり

NISドメイン名(「NIS」という仕組みで出てくる、コンピュータに付けた管理上の名前)を表示・設定するときに使うコマンド
です。


image piyo

詳しく書くよ

順番に見ていきましょう。
まずは予備知識として「NIS」と「NISドメイン名」について簡単に説明します。
「そんなの説明されなくても知ってるよ!」な人は適当に読み飛ばしてください。

NISは「ネットワークにつながっているパソコンとかをまとめて管理するための仕組み(のひとつ)」です。

ネットワーク上にはパソコンとかがいっぱいあります。

ypdomainname【コマンド】

こいつらは基本的に、それぞれ好き勝手に動いています。
自由気ままな奴らですよ。

ypdomainname【コマンド】2

そこに、1台の元締めコンピュータを投入しました。

ypdomainname【コマンド】3

元締めコンピュータは、ネットワーク上で好き勝手やってる奴らを統括的に管理するのが使命です。

ypdomainname【コマンド】4

元締めコンピュータが他のコンピュータのあれやこれやの情報を管理します。

ypdomainname【コマンド】5

このような仕組みのひとつがNISです。
NISは、主にUNIXLinuxとか)で使われる仕組みです。

Windowsの方が詳しい人は「Active Directory(アクティブディレクトリ)」みたいなものだと思ってください。
元締めコンピュータが下々のコンピュータたちの情報をまとめて管理します。

さて、このNISの仕組みですが、コンピュータに名前を付けて管理します。

ypdomainname【コマンド】6

この「NISの仕組みで使われるコンピュータの名前」を「NISドメイン名」と言います。

ypdomainname【コマンド】7

以上を踏まえて

NISドメイン名を表示・設定するときに使うコマンド

が「ypdomainname」コマンドです。
「ypdomainname」コマンドはUNIXLinuxとかMacとか)で使えます。

書き方は

ypdomainname [オプション] [NISドメイン名]

です。

オプションは、あれやこれやとあります……が「hostname」コマンドと同じです。
オプションを指定する機会は、ほとんどないでしょう。

一応 書いておくと

オプション説明
-a別名も表示する
Display the alias name of the host (if used). This option is deprecated and should not be used anymore.
-A設定されている すべてのホスト名をFQDNで表示する……かな?
Displays all FQDNs of the machine. This option enumerates all configured network addresses on all configured network interfaces, and translates them to DNS domain names. Addresses that cannot be translated (i.e. because they do not have an appropriate reverse DNS entry) are skipped. Note that different addresses may resolve to the same name, therefore the output may contain duplicate entries. Do not make any assumptions about the order of the output.
-b設定したホスト名を、ずっと有効にする……かな?でも、このオプションを指定しなくてもずっと有効だよね?分からん
Always set a hostname; this allows the file specified by -F to be nonexistant or empty, in which case the default hostname localhost will be used if none is yet set.
-dDNSドメイン名を表示する
Display the name of the DNS domain. Don't use the command domainname to get the DNS domain name because it will show the NIS domain name and not the DNS domain name. Use dnsdomainname instead. See the warnings in section THE FQDN above, and avoid using this option.
-fホスト名をFQDNで表示する
Display the FQDN (Fully Qualified Domain Name). A FQDN consists of a short host name and the DNS domain name. Unless you are using bind or NIS for host lookups you can change the FQDN and the DNS domain name (which is part of the FQDN) in the /etc/hosts file. See the warnings in section THE FQDN above, and avoid using this option; use hostname --all-fqdns instead.
-F【ファイル名】ホスト名をファイルから読み込む
Read the host name from the specified file. Comments (lines starting with a `#') are ignored.
-iホスト名に対応するIPアドレスを表示する。このオプションが使えなかったら「-I」オプションを使えや
Display the network address(es) of the host name. Note that this works only if the host name can be resolved. Avoid using this option; use hostname --all-ip-addresses instead.
-I設定されている すべてのホスト名に対応するIPアドレスを表示する……かな?
Display all network addresses of the host. This option enumerates all configured addresses on all network interfaces. The loopback interface and IPv6 link-local addresses are omitted. Contrary to option -i, this option does not depend on name resolution. Do not make any assumptions about the order of the output.
-s短縮表現のホスト名を表示する。
Display the short host name. This is the host name cut at the first dot.
-Vバージョン情報を表示する
Print version information on standard output and exit successfully.
-yNISドメイン名を表示・設定する
Display the NIS domain name. If a parameter is given (or --file name ) then root can also set a new NIS domain.
-hヘルプを表示する
Print a usage message and exit.

です。

それでは、実際の使い方を見てみましょう。

オプションを気にしなければ、使い方は簡単です。

何も指定しないで

ypdomainname

を実行すると、設定されているNISドメイン名が表示されます。

ypdomainname [NISドメイン名]

を実行すれば、指定した名前に変更できます。
例えば

ypdomainname piyota

を実行すると、NISドメイン名が「piyota」になります。

それだけです。
オプションの使い方については必要に応じて情報を補完してください。

「ypdomainname」コマンドは実質的に「hostname」コマンドと同じコマンドです。

ypdomainname

を実行するのと

hostname -y

を実行するのは同じ結果になります。

試しに

man ypdomainname

を実行して、マニュアルを表示してみてください。
「hostname」コマンドのマニュアルが表示されるはずです。


image piyo2

一言でまとめるよ

まぁ「ypdomainname」ってコマンドが出てきたら「NISドメイン名(「NIS」という仕組みで出てくる、コンピュータに付けた管理上の名前)を表示・設定するときに使うんだな~」と お考えください。

一番上に戻るよ
スポンサーリンク
書籍画像001
書籍画像037

おまけ

■訳してみるよ

「yp」は多分「Yellow Pages(イエロー・ページズ)」の略です。
「Yellow Pages(イエロー・ページズ)」はタウンページみたいなものです。
「domain(ドメイン)」の意味は「領域」とか「区域」とか「領土」とかです。
「name(ネーム)」の意味は「名前」とかです。
何となく くっつけると

Yellow Pagesの領域の名前

となります。


■検索してみる?




書籍画像
わわわ説明術コラム
宣伝だよ
「分かった!」と思わせる説明の技術 知識ゼロの相手にも伝わるようになる本
実践サイバーセキュリティ入門講座 現場に残された痕跡からハッカーの攻撃を暴け
エンジニアのための生成AI入門 はじめての生成AIアプリ開発からエージェント開発まで