LoginSignup
1
1

More than 5 years have passed since last update.

ホスト名を正引きして逆引きするコマンド

Posted at

ptrhost()

このホスト、どこでホスティングされているんだろうと気になることがあると思います。
正引きをして逆引きをするとどこのVPSだったりIaaSだったりわかるわけなんですが、それを知るコマンドがなかったので関数をつくりました。
コマンドではなく関数を実装したのでタイトルは釣りです。

ptrhost () {
  host $1 | grep -v mail >&2 | rev | cut -d' ' -f1 | rev | xargs -I{} host {}
}

使用例

% ptrhost itochan.jp              
itochan.jp has address 160.16.234.100
itochan.jp has IPv6 address 2001:e42:102:1819:160:16:234:100
100.234.16.160.in-addr.arpa domain name pointer hatsukoi.itochan.jp.
0.0.1.0.4.3.2.0.6.1.0.0.0.6.1.0.9.1.8.1.2.0.1.0.2.4.e.0.1.0.0.2.ip6.arpa domain name pointer 160.16.234.100.v6.sakura.ne.jp.

あら便利。

1
1
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
1
1