How do I figure out what program is using a file?

Discussion in 'MacBook Pro' started by EricVT, Mar 28, 2008.

  1. EricVT macrumors member

    Joined:
    Feb 19, 2008
    #1
    I have some files in the trash that I'm trying to empty, but OSX keeps telling me they are in use. They are video files that I made in Quicktime, and I've quit any program that is running that I would associate with video files.

    How can I tell where these files are being used so I can get rid of them?
     
  2. atluten macrumors 6502

    Joined:
    Mar 24, 2008
    #2
    I've encountered this problem a few times and have found these two methods useful. You can try either or. A few times I've had luck in identifying some processes that may have some links to the video file by using activity monitor and killing that process, but I have to admit it's more trial-and-error. Best of luck.

    1. Log out and log back in, then try deleting the files.
    2. Use the "Secure Empty Trash" option in the Finder menu.
     
  3. mstens macrumors member

    Joined:
    Mar 13, 2008
    #3
    in terminal you can also do the following:

    $ lsof | grep <filename>

    It'll show you plenty of information about it. The first word will be the process name that is using it.

    For example:
    Code:
    mike-macbook-pro:~ mike$ lsof | grep -i 'iTunes Library'
    iTunes    6945 mike   14u     REG       14,2  15958222    2056175 /Users/mike/Music/iTunes/iTunes Library
    
    You can also do lsof /path/to/file
    like this:
    Code:
    mike-macbook-pro:~ mike$ lsof '/Users/mike/Music/iTunes/iTunes Library'
    COMMAND  PID USER   FD   TYPE DEVICE SIZE/OFF    NODE NAME
    iTunes  6945 mike   14u   REG   14,2 15958222 2056175 /Users/mike/Music/iTunes/iTunes Library
     

Share This Page