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


Click here to return to the 'Terminal.app (and rm)' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Terminal.app (and rm)
Authored by: tjfarrell on Apr 05, '05 06:05:09PM
This gets rid of the file's directory entry - but only gets rid of the actual file if nothing has it open. This may be what you want (trash will empty now), but don't expect to always get your disk space back right away. If the file is really open it is only deleted when it is closed (see "man unlink" for details) .

To work out if something has it open, you can probably use the "ls -i" command to get the inode of the file and then use "lsof" to find what has it open. For example

    > cd .Trash
    > ls -i filename
    2808535 filename
    > lsof | grep 2808535

This should tell you the name of the program with open.

(There are many other options to lsof which may help - I haven't had a good look at them, but beware that since you trashed the file, its name may have changed - I don't know if lsof reports the original file name or the current file name)

---
--
T. Farrell

[ Reply to This | # ]