TCP utilities for MacOS

March 13, 2019
tcp

iftop

brew install iftop

For some reason, iftop does not get symlinked to the usual homebrew bin directory, so either symlink it yourself, or move to installation directory.

iftop -i en0

This will start monitoring en0 and display a nice graph with network usage.

tcpdump

If you want to see more traffic information for a specific host, use tcpdump.

sudo tcpdump -i en0 "192.168.1.101"

Alternatively, use wireshark.

MacOS tcpdump

Apple has modified tcpdump to give it the ability to display process information alongside the packets.

sudo tcpdump -i en0 -k N

Here is the list of -k modifiers you can use.

I     interface name (or interface ID)
N     process name
P     process ID
S     service class
D     direction
C     comment
C     flags
U     process UUID (not shown by default)
A     display all types of metadata

nettop

To see a list of processes and their connections, use nettop.

nettop

Press h for the help menu.