首页·终端命令

whois

网络

用法

whois <domain|ip>

查询域名或 IP 段的注册信息;个人字段如今大多被隐去,而每个顶级域的服务器各按自己的格式回复,所以在脚本里解析这些输出很容易失效。

常用选项

选项含义
<domain>Registrar, dates and name servers, if the TLD server publishes them.
<ip>Which organisation owns the address block, and its abuse contact.
-h <server>Query one specific whois server.
-HHide the legal boilerplate that fills most replies.

示例

whois example.com | grep -i expir

When the domain expires.

whois 1.1.1.1

Who owns the address that is hitting your logs.

连不上的时候,这些能把范围缩小——是名字解析不了、没有路由,还是端口被挡。

怎么看

  • 方括号 [ ] 表示这部分可以不写。
  • 省略号 … 表示可以写多个。
  • 选项区分大小写——有些命令里 -r 和 -R 不是一回事。

常见问题

Q. whois 是做什么的?

查询域名或 IP 段的注册信息;个人字段如今大多被隐去,而每个顶级域的服务器各按自己的格式回复,所以在脚本里解析这些输出很容易失效。

Q. 怎么写?

whois <domain|ip> —— 方括号表示可以省略的部分。

Q. 值得记的选项有几个?

这里列了 4 个,完整列表在 man whois。这条命令属于网络。

相关命令

man 手册: man whois