13

This displays the current network transfer rate, using a script obtained from a comment on this MacOSXHints page.

If you want to monitor an ethernet connection instead of the Airport, you can change the first line to en0 instead of en1.

Screenshot

Geeklet files to download

Comments

User Avatar
cmwhitehead 157 days ago
This is a great script! I made is a bit more scalable by adding in a conditional statement to determine what interface is being used. ethernet/wireless.

Add the below code to top of shell script

EN0=`ifconfig en0 | grep 'status' | awk '{print $2}'`

EN1=`ifconfig en1 | grep 'status' | awk '{print $2}'`

if [ $EN0 == 'active' ] ; then

INTF=en0

elif [ $EN1 == 'active' ] ; then

INTF=en1

fi
User Avatar
cycle4passion 140 days ago
Is anyone successfully running this on Lion? Mine broke when I upgraded.
User Avatar
hillscottc 109 days ago
Stopped working for me, too. If I run the script in Terminal, it works fine. But GeekTool just won't display any output. I hope someone can make a suggestion.
User Avatar
cycle4passion 78 days ago
Not my work, pieced together from others, but works in Lion.

EN0=`ifconfig en0 | grep 'status' | awk '{print $2}'`

EN1=`ifconfig en1 | grep 'status' | awk '{print $2}'`

if [ $EN0 == 'active' ] ; then

INTERFACE=en0

elif [ $EN1 == 'active' ] ; then

INTERFACE=en1

fi

SAMPLE_A=(`/usr/sbin/netstat -bI "$INTERFACE" | awk "/$INTERFACE/"'{print $7" "$10; exit}'`);

sleep 1;

SAMPLE_B=(`/usr/sbin/netstat -bI "$INTERFACE" | awk "/$INTERFACE/"'{print $7" "$10; exit}'`);

BANDWIDTH_USAGE=(`echo "2k ${SAMPLE_B[0]} ${SAMPLE_A[0]} - 1024 / p" "${SAMPLE_B[1]} ${SAMPLE_A[1]} - 1024 / p" | dc`);printf "In: \t%.2f Kb/sec\nOut: \t%.2f Kb/sec\n" ${BANDWIDTH_USAGE[0]} ${BANDWIDTH_USAGE[1]};

Log in to comment or register here.