Is there a program that I can use to list processes based on their current network I/O usage? top
does CPU, and on FreeBSD at least, it will also do disk I/O if you pass it -m io
(I assume that there's an equivalent of some kind on Linux, but I don't remember it off the top of my head). But what I'd like is specifically network I/O so that I can see which processes are using it and how much. Is there a program that I can use to list processes that way? And if not, what would be the best alternative?
3 Answers
There's ntop
and nethogs
.
And on Linux there's iotop
for io.
-
-
1I don't remember what package I got ntop from. When I search the repositories now, I find
ntopng
, where the description says (among other things): "ntopng is the next generation version of the original ntop", but I haven't tried it. Nov 6, 2018 at 20:16 -
Indeed! I've downloaded the package nicely.. and realized that it starts a web server and does quite a number of fancy things: ntop.org/products/traffic-analysis/ntop. Thanks for commenting on it, even years after the post– arthurNov 8, 2018 at 7:44
-
1
nethogs
as suggested in the accepted answer is probably the right tool to see network usage by process.
For other console network monitoring tools, here is a list of current tools on Debian 11 (or Ubuntu 20.04 LTS).
apt show bwm-ng cbm dstat iftop iptraf-ng nethogs nload
In alphabetical order, with an excerpt of the description:
bwm-ng
(https://www.gropp.org/?id=projects&sub=bwm-ng)small and simple console-based bandwidth monitor
cbm
(https://github.com/resurrecting-open-source-projects/cbm)The Color Bandwidth Meter (CBM) is a small program to display the traffic currently flowing through the network devices in a simple curses-based GUI.
dstat
(http://dag.wiee.rs/home-made/dstat/)versatile resource statistics tool Dstat is a versatile replacement for vmstat, iostat and ifstat. Dstat overcomes some of the limitations of these programs and adds some extra features. Dstat allows you to view all of your network resources instantly, you can for example, compare disk usage in combination with interrupts from your IDE controller, or compare the network bandwidth numbers directly with the disk throughput (in the same interval).
dstat -n --nocolor -f
dstat -n --tcp --udp -f
- etc.
iftop
(http://www.ex-parrot.com/~pdw/iftop/)displays bandwidth usage information on an network interface iftop does for network usage what top(1) does for CPU usage.
iftop -i interface
# (specify interface. Only 1 at a time)
iptraf-ng
(https://github.com/iptraf-ng/iptraf-ng)IPTraf-ng is an ncurses-based IP LAN monitor that generates various network statistics including TCP info, UDP counts, ICMP and OSPF information, Ethernet load info, node stats, IP checksum errors, and others.
nethogs
(https://github.com/raboof/nethogs)Net top tool grouping bandwidth per process
nload
(http://www.roland-riegel.de/nload/)realtime console network usage monitor
(Use ← and → to move between interfaces to display)
iptraf
might be the thing you are looking for.iptraf-ng
because the oldiptraf
package is abandonware.