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?
4 Answers
There's ntop/ntopng and nethogs.
And on Linux there's iotop for io.
- nethogs is pretty cool. Which package is ntop on ubuntu/debian from?arthur– arthur2018-11-06 17:47:43 +00:00Commented Nov 6, 2018 at 17:47
- 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.Henrik supports the community– Henrik supports the community2018-11-06 20:16:27 +00:00Commented 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 postarthur– arthur2018-11-08 07:44:27 +00:00Commented Nov 8, 2018 at 7:44
- 2ntop and ntopng are huuge. im voting for nethogs and iftopmilahu– milahu2022-06-12 20:05:25 +00:00Commented Jun 12, 2022 at 20:05
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 -fdstat -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)
A new kid in the neighbourhood — bandwhich, not in the ootb repos, but can be built with cargo install bandwhich (if you already have cargo installed), as detailed in the install page. Also, binaries are available on the github project page.
iptrafmight be the thing you are looking for.iptraf-ngbecause the oldiptrafpackage is abandonware.