#!/bin/bash
netstat -lntup \
| awk '/^(tcp|udp)/ {print substr($4, match($4, ":[^:]+$") + 1) "/" $1, substr($NF, 1, index($NF, "/") - 1)}' \
| while read PORT PID
do
BIN=$(readlink /proc/$PID/exe)
echo $PORT $PID $BIN
done
My digital hodgepodge
No comments:
Post a Comment