ホスト名-iとIPアドレス表示の違い

ホスト名-iとIPアドレス表示の違い

hostname -iip address と ??出力の違いは何でありip addr、ipアドレスは何hostname -iに使用されますか?

ベストアンサー1

~によるとman hostname

-i, --ip-address
          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.

その後、ホスト名を取得し、そのホスト名に対してDNSルックアップを実行し、そのアドレスが表示されます。

ip addrすべてのインターフェイス、すべてのIP、エイリアス(存在する場合)、Mac、ステータスなどの完全なリストを提供します。

おすすめ記事