3

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.

1

2 Answers 2

1

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)

Source

2

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

8.03 MiB

3
  • 1
    It gives no output here.
    – SOMN
    Aug 19, 2012 at 8:25
  • Did you install vnstat? Also, for the first few minutes after installation it won't display any data.
    – pelz
    Aug 19, 2012 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.
    – SOMN
    Aug 19, 2012 at 8:30

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .