host
网络
用法
host [-t <type>] <name> [server]查一个名字时用两三行短短地给出地址和邮件服务器;快速确认最省事,但要看完整记录还得用 dig。
常用选项
| 选项 | 含义 |
|---|---|
| -t MX | Restrict to one record type. |
| -a | Everything, equivalent to -t ANY -v. |
| -v | Verbose output closer to what dig prints. |
| -C | Fetch the SOA from every authoritative server, to spot one that is out of sync. |
| <ip> | Give it an address and it does the reverse lookup by itself. |
示例
host example.comAddresses and mail servers in three short lines.
host -t TXT example.comRead the SPF or verification records.
host 8.8.8.8Reverse lookup without needing -x.
连不上的时候,这些能把范围缩小——是名字解析不了、没有路由,还是端口被挡。
怎么看
- 方括号 [ ] 表示这部分可以不写。
- 省略号 … 表示可以写多个。
- 选项区分大小写——有些命令里 -r 和 -R 不是一回事。
常见问题
Q. host 是做什么的?
查一个名字时用两三行短短地给出地址和邮件服务器;快速确认最省事,但要看完整记录还得用 dig。
Q. 怎么写?
host [-t <type>] <name> [server] —— 方括号表示可以省略的部分。
Q. 值得记的选项有几个?
这里列了 5 个,完整列表在 man host。这条命令属于网络。
相关命令
man 手册: man host