brewedbits.dev

Personal blog with guides and news on selfhosting, Linux and AI, from the Netherlands

nextDash nextdash --aboutYour bookmarks. Your terminal. checks your links knows your Docker host one container, no cloudLive demo →nextdash.cc ↗

Tip: nettop -P shows which app on your Mac is using the network

Terminal
~/tips/tip-macos-nettop-per-process

nettop -P -d -t external

Lists every process with its live network traffic, one line per app.

When the Wi-Fi light on the router is blinking like mad and I have no idea which app is responsible, nettop is the tool I’d open. It ships with macOS and shows network traffic per process, live, in the Terminal.

nettop -P -d -t external

-P collapses the view to one line per process, so you don’t get every single connection. -d turns on delta mode, which shows how much changed since the last update instead of a growing total. That’s what you want to see who is busy right now. -t external limits it to real network interfaces and skips loopback traffic between apps on your own Mac. Use -t wifi or -t wired to look at one kind of interface.

While it runs, a few keys help: d toggles delta mode, e expands every process to show its connections, c collapses them again, h shows help and q quits. To follow one app, add -p with its PID or its name as nettop shows it:

nettop -P -d -p 1234

For a script or a quick snapshot, -L prints CSV instead of a live screen. nettop -P -L 1 gives you one sample and stops.

The caveat is the layout. There are a lot of columns, and in a narrow Terminal window most of them fall off the right edge, so make the window wide or use the arrow keys to scroll sideways. Process names also have to match what nettop displays exactly, which can be a truncated version of the real name, so check the list first when -p finds nothing.

Further reading: nettop(1) man page (Xcode man pages)

More Terminal tips ioreg -rn AppleSmartBattery | grep CycleCount Terminal can save your windows and tabs as a window group Export a Terminal profile to a .terminal file and import it on another Mac mc hidutil property --set '{"UserKeyMapping":[{"HIDKeyboardModifierMappingSrc":0x700000039,"HIDKeyboardModifierMappingDst":0x700000029}]}' All Terminal tips (116) All topics

Link