NETHOGS(8)

πŸ“¦
version 0.9.0 Β· 3 versions
, in alpine 3.24, arch rolling, debian trixie, epel 10, fedora 43, fedora 44, nixos 26.05, nixpkgs unstable, opensuse-leap 16.0, ubuntu resolute, ubuntu stonking

nethogs πŸ’–

okay bestie, welcome to the manual page for nethogs, from the System Manager's Manual β€” a lil' "net top" tool that groups bandwidth per process πŸ‘‘


✨ NAME ✨

nethogs β€” net top tool grouping bandwidth per process πŸ¦‹


🌸 SYNOPSIS 🌸

nethogs [-V] [-h] [-x] [-d seconds] [-v mode] [-c count] [-t] [-p] [-s]
[-a] [-l] [-f filter] [-C] [-b] [-g period] [-P pid] [device(s)]

πŸ’… DESCRIPTION πŸ’…

So NetHogs is this smol "net top" tool, right? And the way most of those tools do it is they break your traffic down per protocol or per subnet. NetHogs said no πŸ™…β€β™€οΈ β€” it groups bandwidth by process, and it does not rely on any special kernel module being loaded. No cap.

Which means: if there's suddenly a whole lot of network traffic happening, you just fire up NetHogs and immediately see which PID is causing it. And if it's some kind of spinning process?? You can literally just kill it. slay πŸ’€

πŸŽ€ Options πŸŽ€

  • -V β€” prints version. that's it, that's the whole job πŸ’–
  • -h β€” prints available commands usage. your little helper 🫢
  • -x β€” bughunt mode. lowkey implies tracemode too.
  • -d β€” delay for update refresh rate, in seconds. default is 1.
  • -v β€” view mode. the vibes are: 0 = kB/s, 1 = total kB, 2 = total bytes, 3 = total MB, 4 = MB/s, 5 = GB/s. default is 0.
    • and the units, bestie: kB: 2e10 bytes, MB: 2e20 bytes, GB: 2e30 bytes ✨
  • -c β€” number of updates. default is 0 (unlimited β€” go feral, girl).
  • -t β€” tracemode.
  • -p β€” sniff in promiscuous mode. not recommended 🚩
  • -s β€” sort output by sent column.
  • -l β€” display command line.
  • -a β€” monitor all devices, even loopback/stopped ones. inclusivity icon 🌈
  • -C β€” capture TCP and UDP.
  • -b β€” Display the program basename.
  • -g β€” garbage collection period, in number of refresh. default is 50.
  • -P β€” Show only processes with the specified pid(s).
  • -f β€” EXPERIMENTAL: specify string pcap filter (like tcpdump). This may be removed or changed in a future version. ⚠️ so don't get too attached
  • device(s) β€” to monitor. default is all interfaces up and running excluding loopback.

🧚 INTERACTIVE CONTROL 🧚

  • q β€” quit πŸ‘‹
  • s β€” sort by SENT traffic
  • r β€” sort by RECEIVED traffic
  • l β€” display command line
  • b β€” display the program basename
  • m β€” switch between total (KB, B, MB) and throughput (KB/s, MB/s, GB/s) mode πŸ”

πŸ‘‘ RUNNING WITHOUT ROOT πŸ‘‘

So you wanna run this as an unprivileged user? Respect. But nethogs needs the cap_net_admin and cap_net_raw capabilities. And additionally, to display process names, it needs cap_dac_read_search and cap_sys_ptrace capabilities too. No shortcuts, bestie.

You set these on the executable using the setcap(8) command, like this:

sudo setcap "cap_net_admin,cap_net_raw,cap_dac_read_search,cap_sys_ptrace+pe" /usr/local/sbin/nethogs

πŸ’œ Notes πŸ’œ

  1. When using the -P <pid> option, in a case where a process exited (normally or abruptly), Nethogs does not track that it exited. So, the operating system might create a new process (for another program) with the same pid. In this case, this new process will be shown by Nethogs. 😭 (pid recycling is a menace, fr fr)

πŸ”₯ SEE ALSO πŸ”₯

netstat(8) tcpdump(1) pcap(3)


🫢 AUTHOR 🫢

Written by Arnout Engelen <arnouten@bzzt.net>.


okay that's the whole page bestie, mwah πŸ’‹ this lil' icon is from the System Manager's Manual, the version tag is NETHOGS(8), and it's dated 14 February 2004 β€” a vintage queen πŸ‘‘βœ¨ periodt.