LoginSignup
45
51

More than 5 years have passed since last update.

Linuxで1日あたりのデータ送受信量を算出する方法

Last updated at Posted at 2013-07-19

1. 今までに送受信したバイト数を求める

ifconfig コマンドで調べる:

ifconfig eth0
eth0      Link encap:Ethernet  HWaddr **:**:**:**:**:**  
          inet addr:***.***.***.***  Bcast:***.***.***.***  Mask:255.255.255.0
          inet6 addr: ****::****:****:****:****/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:52041393515 errors:0 dropped:0 overruns:0 frame:0
          TX packets:43058710548 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:7319618510115 (7.3 TB)  TX bytes:50480592202458 (50.4 TB)
          Interrupt:20 

ここの RX bytes:7319618510115 (7.3 TB) がOSを起動してから受信した合計バイト数、 TX bytes:50480592202458 (50.4 TB) がOSが起動してから送信した合計バイト数。

2. OSが起動してからの経過時間を調べる

uptime コマンドで調べる:

uptime
 18:14:30 up 292 days, 18:25,  2 users,  load average: 0.36, 0.34, 0.33

ここの 292 days が経過日数。

3. 送受信量を経過日数で割る

受信: 7.3 TB / 292 = 25.6 GB日
送信: 50.4 TB / 292 = 176.7 GB日
45
51
2

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
45
51