See what process is using a file in Mac OS X

后端 未结 5 634
抹茶落季
抹茶落季 2020-12-04 07:35

I would like to be able to track a file and see which process is touching that file. Is that possible? I know that I can see the list of open processes in activity monitor

5条回答
  •  我在风中等你
    2020-12-04 08:29

    The faster way is:

    $ lsof [path_to_file]
    

    This solution doesn't require the root password and gives you back the following, clear, result:

    COMMAND    PID USER   FD   TYPE DEVICE SIZE/OFF     NODE NAME
    Finder     497  JR7   21r   REG    1,2   246223 33241712 image.jpg
    QuickLook 1007  JR7  txt    REG    1,2   246223 33241712 image.jpg
    

提交回复
热议问题