Since ifconfig
is apparently being deprecated in major Linux distributions, I thought I'd learn something about the ip
tool that's supposed to be used instead of ifconfig
.
And here I ran into a problem: when run on its own, ifconfig
shows the number of bytes received/transmitted on each interface besides other info. I couldn't find a way to get this from ip
. Is there no such function in this tool? What other built-in tools could I use for getting those stats?
Best Answer
Another option is to use the /proc filesystem. The /proc/net/dev file contains statistics about the configured network interfaces. Each line is dedicated to one network interface and it contains statistics for receive and transmit. The statistics include metrics such total number of received/transmittted bytes, packets, drops, errors and so on.
Or you can try the netstat command which can display all network interfaces and related statistics: