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

dnsdomainname【コマンド】

pointこの用語のポイント

pointコマンドだよ

pointUNIX系で使えるよ

point設定されているDNSのドメイン名を表示するよ

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

スポンサーリンク

簡単に書くよ

dnsdomainname【コマンド】とは

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

設定されているDNS(IPアドレスとドメイン名を紐付けしまっせシステム)のドメイン名(IPアドレスに付けた人間様向けの名前)を表示するときに使うコマンド
です。


image piyo

詳しく書くよ

順番に見ていきましょう。
まずは予備知識として

IPアドレス
ドメイン名
DNS


について説明します。
「そんなの説明されなくても知ってるよ!」な人は適当に読み飛ばしてください。

IPアドレスは「コンピュータさん向けのネットワーク上の住所」です。
インターネットっぽい通信において、送信先を特定するときとかに使う情報です。
「198.51.100.2」のような形式になっています。

dnsdomainname【コマンド】

ドメイン名は「IPアドレスに付けた人間様向けの名前」です。
インターネットやメールなどで使われる住所です。
「i-3-i.info」のような形式になっています。

dnsdomainname【コマンド】2

DNSは「IPアドレスとドメイン名を紐付けしまっせシステム」です。

dnsdomainname【コマンド】3

パソコンさんはIPアドレスしか分かりません。
ドメイン名を見せられても「う~ん、どこの住所だろう」と困ってしまいます。

dnsdomainname【コマンド】4

一方、人間様はIPアドレスがピンときません。
「198.51.100.1」と「198.51.100.10」と「198.51.100.11」の違いなんて、パッと見で分かりませんよね。
うっかりミスも増えそうです。

dnsdomainname【コマンド】5

そのため、コンピュータさんはコンピュータさんが分かりやすい形式の住所(IPアドレス)を、人間様は人間様が分かりやすい形式の住所(ドメイン名)を使えるようにするための仕組みがあります。
具体的には、事前にIPアドレスとドメイン名を対応付けておいて、必要に応じて変換するのです。

dnsdomainname【コマンド】6

この「IPアドレスとドメイン名を紐付けて変換する仕組み」をDNSと言います。

dnsdomainname【コマンド】7

以上を踏まえて

コンピュータに設定されているDNSのドメイン名を表示するときに使うコマンド

が「dnsdomainname」コマンドです。

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

書き方は

dnsdomainname [オプション]

です。

オプションは、あれやこれやとあります……が「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.

です。

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

オプションを指定しないで

dnsdomainname

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

「dnsdomainname」でできるのはドメイン名の表示のみです。
ドメイン名を設定することはできません。

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

dnsdomainname

を実行するのと

hostname -d

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

試しに

man dnsdomainname

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


image piyo2

一言でまとめるよ

まぁ「dnsdomainname」ってコマンドが出てきたら「DNS(IPアドレスとドメイン名を紐付けしまっせシステム)のドメイン名(IPアドレスに付けた人間様向けの名前)を表示するときに使うんだな~」と お考えください。

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

おまけ

■訳してみるよ

「dns」は多分「Domain Name System(ドメイン・ネーム・システム)」の略です。
「domain(ドメイン)」の意味は「領域」とか「区域」とか「領土」とかです。
「name(ネーム)」の意味は「名前」とかです。
「system(システム)」はカタカナで「システム」と解釈してください。
「domain(ドメイン)」の意味は「領域」とか「区域」とか「領土」とかです。
「name(ネーム)」の意味は「名前」とかです。
何となく くっつけると

領域名システムの領域の名前

となります。





書籍画像
わわわ説明術コラム
宣伝だよ
「分かった!」と思わせる説明の技術 知識ゼロの相手にも伝わるようになる本【Audible】
実務で役立つ バックアップの教科書 基本の考え方からツール活用・差分管理・世代管理・データ保全・リストア・リカバリー・可用性の確保まで
ウォーターサーバーのキャッチコピーを100本考える方法