802.11 physical mode in command line How can I find which 802.11 protocol (e.g. 802.11ac) my network card is using from the command line?

This provides several ways of doing this using GUI utilities, but I want to be able to do it programmatically.

I have tried airport, netstat, and many other things but haven't found an option that would give me this information.
One correct method seems to be:

system_profiler SPAirPortDataType | awk '/PHY Mode:/ { print $3 ; exit }'


The awk script (between ' ) means:

on first expression 'PHY Mode:', print the third field and exit the script.