Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I need a command that I can run that returns the current utilization of wlan0.

Does such a tool exist? I would prefer something that doesn't require root privileges.

share|improve this question

7 Answers 7

up vote 18 down vote accepted

ifstat doesnt require root. Run it with -S to update the current line instead of printing a new line for each measurement.

egil@mutter:~$ ifstat -S
       eth0
 KB/s in  KB/s out
    0.13      0.26
share|improve this answer
1  
After playing around with some parameters, I got this working. Thanks! –  Nathan Osman Apr 29 '11 at 18:40

bmon runs without root:

enter image description here

If you give it the right parameters it returns only one line

bmon -o 'ascii:noheader;quitafter=1' -p wlan0
wlan0 0.00B 0.0 0.00B 0.0

maybe this helps

share|improve this answer

Try iftop...

but I think that for this you need root privileges.

share|improve this answer

Here is a shell script that prints a short line with realtime data:

#!/bin/bash

ifstat -q -i wlan0 -S 0.1 1 | perl -n -e '/(\d+\.\d+).*(\d+\.\d+)/ && print "Down: $1 KBps - Up: $2 KBps\n"'

Sample Output:

Down: 4.25 KBps - Up: 0.00 KBps

Special thanks to Egil for his answer which pointed me to ifstat.

share|improve this answer

A php soulution similar to the BASH example

#!/usr/bin/php -q
<?php

define('IFSTAT', '/usr/bin/ifstat');
define('LINK', 'wlan0');

$output = exec(IFSTAT . ' -q -i ' . LINK . ' 0.1 1');

$output = preg_replace('/\s+/', ' ', $output);

echo 'DOWN: ' . str_replace(' ', 'Kbps, UP:', trim($output)) . 'Kbps' . PHP_EOL;
share|improve this answer

vnstat provides daily and monthly RX and TX. No root required.

Install vnstat via synaptic. Then open a terminal and enter 'vnstat'

Don't be surprised if you don't get any results for the first day or two. It takes 2-3 days to get results which look like:

    rx:  41.61 GiB      tx:  1.84 GiB      total:  43.46 GiB

monthly rx | tx | total | avg. rate ------------------------+-------------+-------------+--------------- Jun '11 3.55 GiB | 167.75 MiB | 3.71 GiB | 12.02 kbit/s Jul '11 38.07 GiB | 1.68 GiB | 39.74 GiB | 161.42 kbit/s ------------------------+-------------+-------------+--------------- estimated 49.36 GiB | 2.17 GiB | 51.54 GiB |

daily rx | tx | total | avg. rate ------------------------+-------------+-------------+--------------- yesterday 3.35 GiB | 138.04 MiB | 3.48 GiB | 338.34 kbit/s today 1.63 GiB | 84.11 MiB | 1.71 GiB | 183.41 kbit/s ------------------------+-------------+-------------+--------------- estimated 1.80 GiB | 92 MiB | 1.89 GiB |

share|improve this answer

you can also check network usage/traffic monitor from nethogs. you can install it by sudo apt-get install nethogs. then launch it as sudo nethogs <Connection_name>.

Look at the image for example.

enter image description here

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.