LinuxCommandLibrary

ifstat

Monitor network interface traffic statistics

TLDR

View network interface statistics since last query

$ ifstat
copy

View network interface statistics since last boot
$ ifstat [[-a|--ignore]]
copy

View error rate
$ ifstat [[-e|--errors]]
copy

SYNOPSIS

ifstat [-d] [-h] [-i interface] [-n] [-t] [-T] [-V] [interval [count]]

PARAMETERS

-d, --debug
    Enable debug output

-h, --help
    Display help message

-i interface, --iface=interface
    Monitor only specified interface(s)

-n
    Omit header line

-t
    Include total bandwidth row

-T
    Include time and total row

-V, --version
    Show version information

DESCRIPTION

ifstat is a simple, lightweight Linux command-line utility designed to monitor and report the bandwidth usage of network interfaces. It periodically reads statistics from /proc/net/dev, computes the difference in bytes transferred (RX and TX), and displays the rates in kB/s. By default, it shows active interfaces, updating every 1 second indefinitely, with columns for time, interface name, RX kB/s, and TX kB/s.

Unlike snapshot tools like ifconfig or ip link show, ifstat provides ongoing monitoring, making it useful for diagnosing network bottlenecks, tracking usage trends, or scripting alerts. It supports selecting specific interfaces, suppressing headers or timestamps, and including totals. Output is human-readable and easy to parse for logs or further processing.

The tool is extremely efficient, with minimal CPU overhead, suitable for long-running processes on servers. It does not require special privileges, as it relies on publicly readable procfs data.

CAVEATS

Linux-only, reads /proc/net/dev; rates are approximate deltas; no packet/error stats; ignores inactive interfaces by default unless specified.

EXAMPLE

ifstat -i eth0 5
Monitor eth0 every 5 seconds indefinitely.

ifstat -i eth0 -t 1 10
10 updates of eth0+total every 1s.

DATA SOURCE

Polls /proc/net/dev for RX/TX bytes, computes kB/s as delta/interval/1024.

HISTORY

Developed by Nicolas Dichtel in 2000s; version 1.1 released ~2002; maintained for monitoring /proc/net/dev stats simply and efficiently.

SEE ALSO

ip(8), netstat(8), sar(1), nload(1)

Copied to clipboard