Mac Terminal Command Line


Recommended Posts

What is the command line to determine the wifi network you are connected to?

 

Can you also see the history log (such as date/time) that shows the wifi network you have been connected to?

 

What is the line to view the wifi network that your neighbour has been connected to?

 

 

I am sure you could find these by touching the GUI but I wanted to know through command line

Link to comment
Share on other sites

Answer to the first would be to do this: networksetup -getairportnetwork en0

If your Mac has an ethernet port then it may not en0. Find out which device corresponds to wifi by entering networksetup -listallhardwareports

 

You can grab the list of networks you've connected to in total by using the -listpreferredwirelessnetworks switch but it doesn't tell you much about when you accessed them.

 

I'm not aware of the ability to snoop on another device connecting to another wifi network you're not a part of?

 

(OT but holy crap the switches for OS X commands are ridiculously wordy compared to those for other *nix commands!)

Link to comment
Share on other sites

Answer to the first would be to do this: networksetup -getairportnetwork en0

If your Mac has an ethernet port then it may not en0. Find out which device corresponds to wifi by entering networksetup -listallhardwareports

 

I'm not aware of the ability to snoop on another device connecting to another wifi network you're not a part of?

 

(OT but holy crap the switches for OS X commands are ridiculously wordy compared to those for other *nix commands!)

Yes I am experiencing right now how the lines are wordy.

 

btw do you know the cl where it shows the history log of the network you have been connected to?

Link to comment
Share on other sites

btw do you know the cl where it shows the history log of the network you have been connected to?

 

See above edited post. I'm guessing you can probably look in the logs to see activity on en0, although that's quite crude. For instance, I could try grepping through system.log to see when my Mac connected to a wifi network on en0 but not much beyond that:

userXXXXXXX:~ advicepyro$ cat /var/log/system.log | grep "Link Up on en0"
Jul 24 16:18:30 Mactoid kernel[0]: AirPort: Link Up on en0
Jul 24 18:46:57 Mactoid kernel[0]: AirPort: Link Up on en0

I'm sure it's possible somehow but I'm not great with reading Unix logs. :p

 

Keep in mind since the log gets quite large the OS regularly archives system.log so at best you can get data from just the past day unless you want to untar the gzipped archived logs.

Link to comment
Share on other sites

See above edited post. I'm guessing you can probably look in the logs to see activity on en0, although that's quite crude. For instance, I could try grepping through system.log to see when my Mac connected to a wifi network on en0 but not much beyond that:

userXXXXXXX:~ advicepyro$ cat /var/log/system.log | grep "Link Up on en0"
Jul 24 16:18:30 Mactoid kernel[0]: AirPort: Link Up on en0
Jul 24 18:46:57 Mactoid kernel[0]: AirPort: Link Up on en0

I'm sure it's possible somehow but I'm not great with reading Unix logs. :p

 

Keep in mind since the log gets quite large the OS regularly archives system.log so at best you can get data from just the past day unless you want to untar the gzipped archived logs.

Actually, it's a BSD log - OS X, from the beginning, is based on a modified Mach BSD kernel.

Link to comment
Share on other sites

This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.