LoginSignup
9
9

More than 5 years have passed since last update.

ホスト名を調べるのに hostname は使わないほうがいいよ

Posted at

uname をつかう

hostname コマンドは、自ホスト名の変更する時にも使えるから、FQDN を表示しようとして hostname fとかするとまいっちんぐなので、おっちょこちょいのひとは

uname -n

をつかうといいよ。

おまけ

ネットワークインタフェイスに割り当てられているIPアドレスを調べたい時の hostname コマンドは割と便利だ。

hostname -I

-I, --all-ip-addresses
  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.

捗れ〜。

9
9
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
9
9