Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Is there a command to find the total bandwidth used by a Linux box since startup, that returns one line?

The reason I'm asking is I'd like to call this shell not using a terminal and output the results through the web, rather than having a nice animating terminal.

share|improve this question
would something like work instead? Its not a cli application, but you could use to do what you wanted – Journeyman Geek Aug 19 '12 at 7:39
up vote 1 down vote accepted

Try this:

netstat -N -i | awk '{if ($1 > 0 && $4 > 0) print $1,$4,$8}' | grep -i -v name | uniq

The output is like this:

Iface RX-OK TX-OK eth0 16257756 24735708 lo 15049 15049

(Up and Down in Bytes, by interface)

EDIT: After playing for a while:

netstat -i | awk '{print ($4+$8)}'

Is shows only the sum(in bytes) of every interface:

[claudiop@Workstation]# netstat -i | awk '{print ($4+$8)}'

0 0 40994492 30102

(I don't know from where came the "0"s, but you can easly filter the output)


share|improve this answer

vnstat | awk '$7~/total/ {print $8,$9}' will output something like this:

8.03 MiB

share|improve this answer
It gives no output here. – Cláudio Pereira Aug 19 '12 at 8:25
Did you install vnstat? Also, for the first few minutes after installation it won't display any data. – pelz Aug 19 '12 at 8:29
If i didn't it had an output like this: "bash: vnstat: command not found", but it simply gives no output. I have vnstat, and i am using arch. – Cláudio Pereira Aug 19 '12 at 8:30

Your Answer


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.