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

Easily list open files and their owners Apps
In a followup to this hint on 'lsof', I'd like to mention a free, open-source Cocoa GUI wrapper I did for lsof called Sloth, which presents a list of open files on your system along with the owning process. It has "Reveal In Finder" and "Kill" buttons to make it easier to get around annoying messages such as these:
The operation cannot be completed because the item [whatever] is in use
With Sloth, you can easily find the owning process in question and kill it. Of course Sloth doesn't support all the fancy advanced options which can be passed to lsof, but it's just fine for most functionality.
    •    
  • Currently 2.50 / 5
  You rated: 3 / 5 (4 votes cast)
 
[19,864 views]  

Easily list open files and their owners | 4 comments | Create New Account
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: figz on Mar 01, '04 10:58:35AM

If I could only do this in Windows (at work)! I reboot at least once a week because some random process has kidnapped my file. Ironically, I'll probably never use this hint on my Mac because it hardly ever happens!



[ Reply to This | # ]
Easily list open files and their owners
Authored by: nekura on Mar 01, '04 02:30:55PM
Try the "handle" or "process viewer" freeware tools from SysInternals (www.sysinternals.com), it should solve your problems on Windows platform.

[ Reply to This | # ]
Easily list open files and their owners
Authored by: osxpounder on Mar 01, '04 12:48:23PM

Sveinbjorn Thordarson, you are a beautiful human being. Thank you for this wonderful program.

---
--
osxpounder



[ Reply to This | # ]
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 | # ]