How to Monitor Network Interface Bandwidth in Linux Terminal Using ifstat

Monitoring incoming and outgoing network throughput in real time is vital when benchmarking server capacity, diagnosing saturated uplinks, or inspecting large background transfers. While tools like netstat or ip -s link display cumulative packet totals, the lightweight ifstat (interface statistics) command-line utility samples active traffic intervals and outputs clean, scrolling tabular updates of instantaneous kilobyte-per-second or megabit-per-second transmission rates.

Installing ifstat on Linux Distributions

The ifstat tool is available in official package repositories across major Linux distributions:

For Ubuntu and Debian systems:

sudo apt update && sudo apt install -y ifstat

For Fedora, AlmaLinux, and CentOS Stream (via EPEL):

sudo dnf install -y epel-release && sudo dnf install -y ifstat

For Arch Linux:

sudo pacman -S ifstat

Basic Bandwidth Monitoring Syntax

Running ifstat without any arguments displays an ongoing table showing incoming (KB/s in) and outgoing (KB/s out) traffic across all active network interfaces updated every second:

ifstat

The output resembles:

       eth0               wlan0       
 KB/s in  KB/s out   KB/s in  KB/s out
    2.15      1.40      0.00      0.00
  145.20     12.80      0.00      0.00
  850.40     45.10      0.00      0.00

Press Ctrl + C at any time to terminate live monitoring.

Customising Sample Delay and Count

You can control the polling frequency and define an exact number of monitoring iterations by passing interval and count values:

  • Sampling every 2 seconds for 10 iterations:
    ifstat 2 10
  • Sampling high-resolution sub-second intervals (e.g. every 500 milliseconds):
    ifstat 0.5

Filtering Specific Interfaces and Adding Timestamps

In multi-homed servers hosting multiple Ethernet ports, bridge devices, and virtual tunnel interfaces (such as Docker or WireGuard), monitoring every interface clutters the terminal. Use the following practical flags to refine output:

  • Targeting a Specific Interface: Use -i followed by the interface name:
    ifstat -i eth0
  • Targeting Multiple Interfaces: Separate interface names with commas:
    ifstat -i eth0,wg0 1
  • Adding Timestamps: Pass -t to prepend exact timestamps to each reading, which is invaluable when correlating network spikes with application error logs:
    ifstat -t -i eth0 1
  • Displaying Bandwidth in Bits per Second: By default, ifstat measures throughput in kilobytes per second (KB/s). Use the -b flag to display values in kilobits per second (Kbps):
    ifstat -b -i eth0 1

Logging Throughput Data to a File for Capacity Auditing

Because ifstat writes formatted text to standard output, you can pipe live metrics into a log file while monitoring long-running rsync migrations, database replications, or load tests:

ifstat -t -i eth0 5 | tee network_throughput.log

This command logs timestamped bandwidth readings every five seconds while simultaneously displaying the stream in your terminal window.

Get the best tech tips delivered straight to your inbox.

Join thousands of readers mastering Apple, Google, Microsoft, and Linux.