Take the 2-minute tour ×
Ask Different is a question and answer site for power users of Apple hardware and software. It's 100% free, no registration required.

I know you can do ifconfig | grep inet, but that shows you several IP addresses. How do I get the specific one for SSHing et al?

share|improve this question
add comment

3 Answers

up vote 5 down vote accepted

Use ipconfig getifaddr en1 for wireless, or ipconfig getifaddr en0 for ethernet.

share|improve this answer
add comment

In a terminal window, after the $ sign, do: curl ipecho.net/plain; echo

share|improve this answer
While you can get the WAN IP address with this command, you may need the LAN IP for SSH access depending on your setup. –  Scot Feb 14 at 6:20
add comment

You can use the following command to find ip address on Linux :

ip addr show


ip addr show eth0

Sample output : eth0: mtu 1500 qdisc mq state UP qlen 1000 link/ether b8:ac:6f:65:31:e5 brd ff:ff:ff:ff:ff:ff inet brd scope global eth0 inet6 fe80::baac:6fff:fe65:31e5/64 scope link valid_lft forever preferred_lft forever You can also check your ip using the site http://www.ip-details.com/ .

share|improve this answer
Answers relating to Linux don't really help on an OS X site :-) –  patrix Apr 2 '13 at 9:14
add comment

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.