Show bandwith in shell

Hello,

systat -ifstat is really nice, but I want to save the actual bandwidth-output of interface em0 in a .txt file and put it out to a website. It's not working. Does anyone know how i i I can see the actual bandwith (net in and net out) in KB/s or MB/s and whether it's possible to save it with awk print etc.?
 
You could use netstat():

Code:
% netstat -bw1
            input        (Total)           output
   packets  errs idrops      bytes    packets  errs      bytes colls
     70319     0     0  101651514      37276     0    2702676     0
     78435     0     0  113373694      41573     0    3013596     0
     65947     0     0   95498082      34960     0    2535880     0
     74875     0     0  108352680      39693     0    2878239     0
     78228     0     0  113338196      41419     0    3003246     0
     79934     0     0  115649004      42340     0    3069216     0
^C
%
 
Back
Top