Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the 'Easily list open files and their owners' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Easily list open files and their owners
Authored by: razberry636 on Mar 02, '04 01:47:56AM
You can use lsof to view nework connections as well.

I find this useful when I'm using iTunes:

lsof | fgrep iTunes
[snip]
iTunes    29301 jason   20u  IPv4 0x0268bce4        0t0      TCP my.computer:daap->another.computer:49253 (ESTABLISHED)
iTunes    29301 jason   21r  VREG      14,28    6730659  1360895 /Volumes/Users/jason/Music/iTunes/iTunes Music/Delerium/Chimera/05 Truly.m4a
iTunes    29301 jason   22u  IPv4 0x014a4ad8        0t0      TCP my.computer:daap->another.computer:49256 (ESTABLISHED)
[snip]

As you can see, there are two connections between my computer and another computer. The addresses have been changed to protect the innocent.

This shows that someone else is listening to my iTunes music, which I encourage. (I live on a college campus; there are between 3 and 10 other iTunes users at any time whose music I can listen to. And I keep my iTunes library available for others.) If there are two TCP connections (such as in the example given above) then that other person is streaming music from my computer. This is usually (not always) accompanied by an open song file. If there is only one TCP connection to the other computer then that person has only made a connection and is not streaming at this time.

You can see that iTunes has a m4a (AAC encoded audio) file open. If I'm not listening to Truly then that means the visitor is listening to it.

Here is another example. Suppose you want to know the exact address of an internet station that you're listening to so that you can use streamripper or something:

lsof | fgrep iTunes
[snip]
iTunes    29301 jason   22u  IPv4 0x02320d1c        0t0      TCP my.computer:49262->64.236.34.196:http (ESTABLISHED)
[snip]

Now you know that 64.236.34.196 is the streaming server in question.

[ Reply to This | # ]