如何通过 Linux 命令行将域名转换为 IP

Linux中是否有将域名转换为IP地址的命令?

183701 次浏览

你可以使用:

nslookup www.example.com

使用这个

$ dig +short stackoverflow.com


69.59.196.211

或者这个

$ host stackoverflow.com


stackoverflow.com has address 69.59.196.211
stackoverflow.com mail is handled by 30 alt2.aspmx.l.google.com.
stackoverflow.com mail is handled by 40 aspmx2.googlemail.com.
stackoverflow.com mail is handled by 50 aspmx3.googlemail.com.
stackoverflow.com mail is handled by 10 aspmx.l.google.com.
stackoverflow.com mail is handled by 20 alt1.aspmx.l.google.com.