lsof - Command-Line Tip of the day
July 29th, 2008So you want to monitor, continuously, the traffic in or out of your box on port 80. You want to monitor web traffic.
You’re going to run the following:
lsof -r -i:80
This will output something like the following:
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
iTunes 3132 italisman 32u IPv4 0x808aa68 0t0 TCP 172.16.2.169:61644->akamai-072.sfo1.speakeasy.net:http (CLOSE_WAIT)
iTunes 3132 italisman 33u IPv4 0x7a15270 0t0 TCP 172.16.2.169:61731->akamai-071.sfo1.speakeasy.net:http (CLOSE_WAIT)
Safari 26240 italisman 9u IPv4 0x706f270 0t0 TCP 10.1.235.183:62762->95767-www1.affiliatemakeover.com:http (ESTABLISHED)
Safari 26240 italisman 12u IPv4 0x70c5a68 0t0 TCP 10.1.235.183:62759->209-20-80-227.slicehost.net:http (ESTABLISHED)
Safari 26240 italisman 13u IPv4 0x71e666c 0t0 TCP 10.1.235.183:62778->192.217.199.107:http (ESTABLISHED)
Safari 26240 italisman 16u IPv4 0x808ae64 0t0 TCP 10.1.235.183:62777->track1.mbl.vip.sp1.yahoo.com:http (ESTABLISHED)








