Your server is busy on the network and you want to know why? nethogs shows the traffic per program, iftop per connection, live. For the totals per day and month, use vnStat: See How Much Traffic Your Linux Server Uses: vnStat. The steps were tested on Ubuntu 26.04 LTS while a download and a torrent client were running; run the commands as root.
1. Install
apt install nethogs iftop
Find the name of your network card, for example eno0: ip -br link or vnstat --iflist.
2. Per Program: nethogs
nethogs eno0
A list of programs, refreshed every second, with SENT and RECEIVED in KB/s. The column PROGRAM shows the program and its process number, USER who runs it. Press m to switch between KB/s and totals, q to quit.
For a short text report instead of the live screen, for example to send to support: four refreshes, two seconds apart:
nethogs -t -c 4 -d 2 eno0
Each line is program/process/user-number, sent and received in KB/s. A download running as the user with number 1000 shows up like this:
curl/34973/1000 21.6387 20654
That is about 20 MB/s received by curl.
3. Per Connection: iftop
iftop -i eno0 -n -P
Every line is a pair: your server and the other side, with arrows for the direction (=> sent, <= received) and the speed over the last 2, 10 and 40 seconds. -n shows IP addresses instead of names, -P the ports. Press q to quit.
A text report over 6 seconds:
iftop -i eno0 -t -s 6 -n -N -P
# Host name (port/service if enabled) last 2s last 10s last 40s cumulative
1 203.0.113.80:44770 => 135Kb 146Kb 146Kb 110KB
198.51.100.166:443 <= 126Mb 147Mb 147Mb 110MB
2 203.0.113.80:2804 => 2.85Kb 2.55Kb 2.55Kb 1.91KB
192.0.2.212:3334 <= 0.98Kb 681b 681b 511B
- Line 1: a download over HTTPS (port 443 on the other side), about 147 Mbit/s received.
- Line 2 and more like it: a torrent client talking to many peers on its own port (here
2804), each with a little traffic. - iftop shows bits per second (
Mb= megabits); divide by 8 for megabytes.
What Next?
- A torrent client using too much? Set upload and download limits in its settings.
- A program you do not know? Find what it is:
ps -fp 34973(the process number from nethogs). If it should not be there, see What Fills the Disk and What Loads the Server and check your firewall: Protect Your Linux Server With a Firewall and Fail2ban. - Slow or broken connections to one place: Check the Network of Your Linux Server: ping, mtr and iperf3.