ネットワークの転送量を調べる方法

linuxで通信量を調べるなら /proc/net/dev を見るのが簡単です

$ cat /proc/net/dev

受信データは第2カラム,送信データは第10カラムにあります.単位は bytes です

Inter-|   Receive                                                |  Transmit
 face |bytes    packets errs drop fifo frame compressed multicast|bytes    packets errs drop fifo calls carrier compressed
eth0: 913105832 1075514    0    0    0     0          0     35195 128720564  778666    0    0    0     0       0          0

スペース区切りなので,awkとかで簡単に情報を加工できます

awkならこんな感じで

$ awk '$1=="eth0:" {printf "rx: %fMB tx: %fMB\n", $2/1024/1024, $10/1024/1024}' < /proc/net/dev

grep + bashならこんな感じで

$ grep ^eth0: /proc/net/dev | while read x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11; do echo $((x2 / 1024 / 1024)) $((x10 / 1024 / 1024)); done