Monday, September 05, 2011

How to get network information in Linux

Following files/dirs can be directly read:

/proc/net/dev
/sys/class/net/<if_name>/
/sys/class/net/<if_name>/statistics

Tool netstat is your friend to get network-related information:

netstat -I  # display interface info
netstat -s  # display statistics info
netstat -r  # display routing info
netstat -tlnp  # display TCP listening info

Other tools: sar, ifconfig, iftop