Count of Packets by Local Port
This DTrace one-liner counts UDP received packets by the local UDP port:
# dtrace -n 'udp:::receive { @[args[4]->udp_dport] = count(); }'
dtrace: description 'udp:::receive ' matched 1 probe
^C
33294 1
33822 1
38961 1
44433 1
46258 1
46317 1
47511 1
50581 1
54685 1
56491 1
59056 1
62171 1
62769 1
64231 1
The preceding output shows that 1
packet was received for port 33294
, 1
packet was received for port 33822
, and so on.