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

Generate list of wi-fi networks a Mac has used Network
You can find out which wi-fi networks a Mac has connected to by going to the Network preference pane, then clicking on Advanced, then on the Wi-Fi tab; they'll be listed in Preferred Networks. But if you want to do this from Terminal - say for a Mac you've connected to via ssh - this hint, posted on OS X Daily, can do it as well:
defaults read /Library/Preferences/SystemConfiguration/com.apple.airport.preferences RememberedNetworks | egrep -o '(SSID_STR|_timeStamp).+' | sed 's/^.*= \(.*\);$/\1/' | sed 's/^"\(.*\)"$/\1/' | sed 's/\([0-9]\{4\}-..-..\).*/\1/'
The list will be the same as that in Preferred Networks, and you can't alter it, but it my be useful in some situations.
    •    
  • Currently 2.82 / 5
  You rated: 1 / 5 (11 votes cast)
 
[7,741 views]  

Generate list of wi-fi networks a Mac has used | 4 comments | Create New Account
Click here to return to the 'Generate list of wi-fi networks a Mac has used' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Generate list of wi-fi networks a Mac has used
Authored by: geek-e on Dec 27, '12 08:09:00AM
This command also works and is easier to remember:
networksetup -listpreferredwirelessnetworks en1


[ Reply to This | # ]
Generate list of wi-fi networks a Mac has used
Authored by: Shane Palmer on Dec 27, '12 11:45:10AM
It might be easier and much cleaner looking to use Apple's built-in networksetup tool:

networksetup -listpreferredwirelessnetworks en1

If you have a Mac that does not have wired ethernet, like a MacBook Air, then you might need to use en0 instead of en1. Using Apple's built-in tool should also remove the need to worry about OS differences as mentioned in the comments of the original linked article.

[ Reply to This | # ]
Generate list of wi-fi networks a Mac has used
Authored by: azeotropo on Dec 28, '12 03:43:12AM

The command in the hint didnt' work for me in Mac OS X 10.6.8, but the one on the comments #1 and #2 did. Thanks



[ Reply to This | # ]
Generate list of wi-fi networks a Mac has used
Authored by: slvrstn on Jan 01, '13 11:34:54AM
For 10.6.8, use "KnownNetworks" instead of "RememberedNetworks"

As to the use of networksetup for this, it's not really the same thing.
listpreferredwirelessnetworks is just that, the list of Preferred Networks that you have configured.

What the original hint is showing is the last time you've connected to any wireless SSID, regardless if you've marked it preferred or not.
Might help to narrow down a location if you pick up something nasty while mobile.

I've condensed all the grep/sed's down to one (equally incomprehensible) call to perl:

defaults read /Library/Preferences/SystemConfiguration/com.apple.airport.preferences KnownNetworks  | perl -lane 'print $1 if /SSID_STR.*= "?(.*?)"?;/ || /_timeStamp.*= "(\d{4}-\d\d-\d\d)/'


[ Reply to This | # ]