1

In Linux I can do: ip -4 address show or (more verbosely): ip -family inet address show to retrieve information on IP addressing. This command returns:

1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN     group default
inet 127.0.0.1/8 scope host lo
   valid_lft forever preferred_lft forever
3: wlan0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
inet 10.0.1.65/24 brd 10.0.1.255 scope global wlan0
   valid_lft forever preferred_lft forever

I'd like to retrieve the same information in OS X from a terminal, without installing additional software and without elevating user privileges. Is any one familiar with the OS X equivalent of this command?

For reference, here's the Bash Version I'm using in Mac OS X: GNU bash, version 3.2.57(1)-release (x86_64-apple-darwin15) .

1
  • Use netstat: netstat -nr Oct 27 '16 at 15:24
3

The commands that you want are:

  • ifconfig -a inet
  • ifconfig -a inet6

Bonus commands:

  • arp -a
  • ndp -a

These are all the same as on FreeBSD and TrueOS. (This is not universally the case for MacOS, but is the case here.)

Further reading

  • ifconfig. Mac OS 10 Manual Pages. Apple corporation. 2008.
1
  • This is helpful. Would you know which ifconfig option would allow me to query only physical interfaces so that my output corresponds (closely) to that in my initial question?
    – marshki
    Oct 27 '16 at 20:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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