Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the 'Retrieve network info from the command line' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Retrieve network info from the command line
Authored by: ambrose on Jun 17, '10 12:02:39PM
There is a command-line configuration tool called networksetup which acts as an interface to the Network Panel of the System Preferences app. It's not capable of providing all the information obearsstate's script does, but it does present a some of it, with the advantage of cutting down on the need for variable assignments and stream editing. It also offers other information some may find useful. As always, the man pages are the place to go, but just to whet the appetites of those who care about such things, here's a partial list of networksetup's command flags:

[-listnetworkserviceorder]

[-listallnetworkservices]

[-listallhardwareports]

[-detectnewhardware]

[-getmacaddress hardwareport]

[-getcomputername]

[-getdnsservers networkservice]

[-getsearchdomains networkservice]

[-getwebproxy networkservice]

[-getstreamingproxy networkservice]

[-getairportnetwork]

[-getairportpower]

[-getnetworkserviceenabled networkservice]

[-createnetworkservice hardwareport]

[-ordernetworkservices service1 [service2] [service3] [...]]

[-getMTU hardwareport]

[-getmedia hardwareport]

[-listvalidmedia hardwareport]

[-listdevicesthatsupportVLAN]

In cases where it is possible, the commands are able to set preferences as well as get them. (FWIW, there's another useful System Preferences command-lne tool called systemsetup. I think it's at least worth a look.

[ Reply to This | # ]

Retrieve network info from the command line
Authored by: feyd.rm on Jun 17, '10 03:06:52PM
Agreed if you are dealing with Mac Pros or MacBook Airs,
$ networksetp -listallhardwareports
can give you a better picture of what is going on.

[ Reply to This | # ]
Retrieve network info from the command line
Authored by: dzurn on Jun 29, '10 03:51:29PM
Missing a "u". Should be:

$ networksetup -listallhardwareports

---
Madness takes its toll.
Please have exact change.


[ Reply to This | # ]