Jan 29, '04 09:16:00AM • Contributed by: Garin
Ever try to empty your trash, only to find that your request is refused because apparently some program is still using that file, so you get this nice message:
The operation cannot be completed because the item [whatever] is in use.
Sometimes this is a handy sanity check. Other times it's a downright nuisance, because you're just SURE that no program should legitimately be using that file. It happens to me frequently enough that I figure someone else could benefit from a little UNIX lore. The command-line UNIX program lsof rides to the rescue. This program lists all open files and file-like things. This is very handy, as nearly everything looks like a file in UNIX (and Mac OS X).
$ lsof | grep [whatever]
Where [whatever] is replaced with the filename you're looking for. With this, you can see which program is desperately holding onto your about-to-be-trashed file. Once you exit that program, your trash will empty.