How to check network statistics?

To check network statistics on a Linux system, you can use several commands that provide insights into network performance, including packet transmission, reception, and errors. Here are some commonly used commands:

This command displays statistics for all network interfaces, including the number of packets transmitted and received, as well as any errors.

Example:

ip -s link show

Output Explanation:

  • RX: Received packets and bytes.
  • TX: Transmitted packets and bytes.
  • errors: Number of packets that encountered errors.
  • dropped: Packets that were dropped.

2. Using netstat Command

The netstat command can also be used to view network statistics, including interface statistics.

Example:

netstat -i

Output Explanation:

  • Iface: Name of the network interface.
  • RX-OK: Packets received without errors.
  • RX-ERR: Packets received with errors.
  • TX-OK: Packets transmitted without errors.
  • TX-ERR: Packets transmitted with errors.

3. Using ifconfig Command

Although ifconfig is deprecated in favor of the ip command, it can still be used on some systems to view interface statistics.

Example:

ifconfig

Output Explanation:

  • Displays information about each network interface, including the number of packets received and transmitted.

4. Using sar Command

The sar command (part of the sysstat package) can provide detailed statistics over time.

Example:

sar -n DEV

Output Explanation:

  • Displays network statistics for each interface, including the number of packets received and transmitted, along with errors.

Conclusion

These commands are useful for monitoring network performance and diagnosing issues. You can choose the one that best fits your needs or use them in combination for a comprehensive view of your network statistics.

If you have any further questions or need additional examples, feel free to ask!

0 Comments

no data
Be the first to share your comment!