Fast way to check if file is open on OS X
Is there a fast way to check if a file handle is closed from the command line on 开发者_运维技巧os x?
lsof
works, of course, but is super slow.
You´ll probably want to check out the DTrace Family man dtrace
.
If you´re only interested on pure "file actions" you should have a look at opensnoop
, which builds on DTrace and has been included since Mac OS X 10.6.
You can show all file in use by a process (by -p pid or -n name) and watch files with -f /path/to/file .
精彩评论