How to Monitor Network Traffic in htop?
This article provides a quick overview and practical guide on how to
monitor network-related process statistics using the htop
interactive process viewer in Linux. While traditionally focused on CPU,
memory, and disk I/O, newer versions of htop support
real-time network usage tracking per process. You will learn how to
check if your version supports this feature, how to enable the relevant
network columns, and how to interpret the data to identify
bandwidth-hogging applications.
Checking for Network Monitoring Support
Not all versions of htop include network statistics out
of the box. This functionality relies on htop being
compiled with delay accounting support (via the Linux kernel’s
taskstats) or specific network monitoring patches.
To check if your version supports it, open htop by
typing htop in your terminal, and press F2
(or S) to enter the Setup menu.
Navigate to the Columns section. If you can find
columns named NET_RX (Network Received) and
NET_TX (Network Transmitted) under the “Available Columns”
list, your version supports network monitoring.
Enabling Network Columns in htop
If your system supports it, you must manually add the network columns to your main display. Follow these steps to configure your view:
- Open
htopin your terminal. - Press F2 to open the Setup menu.
- Use the arrow keys to select Columns in the “Setup” left-hand pane.
- Move to the “Available Columns” right-hand pane and scroll down until you find NET_RX and NET_TX.
- Press F5 (or Enter depending on your version) on each to add them to your “Active Columns” list.
- In the “Active Columns” pane, use F7 (Move Up) or F8 (Move Down) to position the network columns where you want them to appear on your screen.
- Press F10 to save your changes and return to the main process list.
Interpreting Network Process Statistics
Once enabled, two new columns will appear in your htop
interface:
- NET_RX: Displays the rate of data the process is actively receiving (downloading) over the network.
- NET_TX: Displays the rate of data the process is actively transmitting (uploading) over the network.
These values fluctuate in real-time, matching the update interval of
your htop screen. To easily spot which application is
draining your bandwidth, you can click on the NET_RX or
NET_TX column headers to sort all running processes by
their network activity.
Alternative Solutions for Older htop Versions
If your version of htop does not feature these columns,
the underlying Linux kernel or the specific package build lacks the
required patches. In such scenarios, you can use dedicated network
process monitoring tools alongside htop. Command-line
utilities like nethogs group network traffic by process
PID, while iftop monitors overall bandwidth usage by
interface, serving as excellent companions to a standard
htop setup.