Sometimes I get curious about how much data a network interface has transferred. Actually, I get curious quite frequently after I got an LTE modem for my laptop.
Usually, I just use ifconfig:
$ ifconfig wlp3s0
wlp3s0 Link encap:Ethernet HWaddr 00:15:00:7e:af:bd
inet addr:192.168.0.165 Bcast:192.168.0.255 Mask:255.255.255.0
inet6 addr: fe80::4c15:ef76:132e:768/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:20922893 errors:0 dropped:0 overruns:0 frame:0
TX packets:20916831 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:15370202859 (15.3 GB) TX bytes:13050802316 (13.0 GB)
With Ubuntu 18.04, however, there is no ifconfig. Yes, I know I can install it, but I wanted to learn how I should be doing it.
I came up with this, using the ‘ip’ command:
$ ip -s -h addr show wlp3s0
3: wlp3s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
link/ether 00:15:00:7e:af:bd brd ff:ff:ff:ff:ff:ff
inet 192.168.0.165/24 brd 192.168.0.255 scope global dynamic wlp3s0
valid_lft 5439sec preferred_lft 5439sec
inet6 fe80::4c15:ef76:132e:768/64 scope link
valid_lft forever preferred_lft forever
RX: bytes packets errors dropped overrun mcast
15.4G 20.9M 0 0 0 0
TX: bytes packets errors dropped carrier collsns
13.1G 20.9M 0 0 0 0
Meh. This is gonna take some time to get used to.