airport command line utility

At


/System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport

There is a very neat airport command line program. Starting it with –help will show you the possible options.
I like specially the -I option to show me the actual strenght of the signal etc in numbers. Not some bars. It also
seems to accurate more precisly what is going on. I wrote a quick perl wrapper to give me the outputs I care about
as a one line:


#!/usr/bin/perl

#airport usually is in /System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources
use strict;
my $sleep = $ARGV[0] || 3;

my %trans = (
"commQuality" , "cQ",
"rawQuality" , "rQ",
"avgSignalLevel" , "sL" ,
"avgNoiseLevel" , "nL" ,
"lastTxRate" , "lR" ,
"maxRate" , "mR" ,
"Security" , "sec:"
);
while (1){
#print "x\n";
foreach my $o (`airport -I`){
#print "y $o\n";
$o =~ /\s*([^\:]+): (.*)/;
my $k = $1;
my $v = $2;
if ($trans{$k}){
print "$trans{$k} $v ";
}
#print "$k -> $v\n";
}
print "\n";
sleep ($sleep);
}

The other helpful option is the -s one: It scans all base stations it can find and displays them. Much better than the gui menu.

Moving this program in the bin folder would be a nice move by apple. Giving it a man page would even be better. But the way it is is certainly much better than nothing.

4 Responses to “airport command line utility”

  1. Paul Charles Leddy Says:

    well, -l option is missing, or i have something wrong. damn jobs!

  2. Andreas Wacker Says:

    I think it is still there under 10.5.4 but has changed it’s location to

    /System/Library/PrivateFrameworks/Apple80211.framework/Versions/A/Resources/airport

    it’s output when running with -I (capital i) is now somewhat different:

    agrCtlRSSI: -64
    agrExtRSSI: 0
    agrCtlNoise: -98
    agrExtNoise: 0
    state: running
    op mode: station
    lastTxRate: 54
    maxRate: 54
    lastAssocStatus: 0
    802.11 auth: open
    link auth: unknown
    BSSID: 0:77:77:77:77:77
    SSID: Something_Access
    MCS: -1
    channel: 6

    so the script would need to be changed accordingly.

  3. Paul Charles Leddy Says:

    here are some additions to show a visual. i am running 10.5 on a new macbook

    ya, it is a capital “eye”, not “el”, heh

    #!/usr/bin/perl

    #airport usually is in /System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources
    use strict;
    my $sleep = $ARGV[0] || 3;

    my %trans = (
    “agrCtlRSSI”, “dick”,
    # “commQuality” , “cQ”,
    # “rawQuality” , “rQ”,
    # “avgSignalLevel” , “sL” ,
    # “avgNoiseLevel” , “nL” ,
    # “lastTxRate” , “lR” ,
    # “maxRate” , “mR” ,
    # “Security” , “sec:”
    );
    while (1){
    #print “x\n”;
    foreach my $o (`airport -I`){
    #print “y $o\n”;
    $o =~ /\s*([^\:]+): (.*)/;
    my $k = $1;
    my $v = $2;
    if ($trans{$k}){
    # print “$trans{$k} $v “;
    foreach (1..abs($v)) { print “x”; }
    print ” - $v - “;
    }
    #print “$k -> $v\n”;
    }
    print “\n”;
    # sleep ($sleep);
    foreach (1..1000000) {}
    }

  4. John Burgoon Says:

    Suggestion:
    Make a link from /usr/bin/ called “airport” and then you can just type “airport” instead of all that long command line.

    sudo ln -s /System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport /usr/sbin/airport

    Does anyone know if there are timeout or power saver settings for airport that might cause it to drop VPN connections?

Leave a Reply

You must be logged in to post a comment.