How to get the ip address of a domain from the terminal in macOS
To get the IP address of a domain from the terminal in macOS, we can use the dig or nslookup command. Here's how:
To get the IP address of a domain from the terminal in macOS, we can use the dig
or nslookup
command. Here's how:
Using dig
:
dig +short DOMAIN_NAME
For example to get the ip address for www.google.com, the command is like below:
$ dig +short www.google.com
142.251.222.228
Using nslookup
:
nslookup DOMAIN_NAME
Example:
$ nslookup www.google.com
Server: 2001:fb0:100::207:29
Address: 2001:fb0:100::207:29#53
Non-authoritative answer:
Name: www.google.com
Address: 216.58.200.4