获取OS X中打开的文件(描述符)列表 [英] Get list of open files (descriptors) in OS X

查看:123
本文介绍了获取OS X中打开的文件(描述符)列表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在os x(10.9.1)上的进程中获取打开文件的列表.在Linux中,我可以从/proc/PID/fd中获得它.但是我不确定如何在OS X上获得相同的功能.我发现procfs在OS X上不存在(默认情况下,可能存在实现,但我不想那样做).

I would like to get a list of open files in a process on os x (10.9.1). In Linux I was able to get this from /proc/PID/fd. However I'm not sure how to get the same on OS X. I found that the procfs is not present on the OS X (by default. possible implementations present, but I do not want to go that way).

所以我如何(自然地)在OS X上的进程中获取打开文件的列表.一种方法是lsof.还有其他支持吗?请让我知道我在哪里可以获得更多信息.

So how do I get (natively) the list of open files in a process on OS X. One way is lsof. is there any other support available? please let me know where I can get more info on this.

谢谢.

推荐答案

至少在OSX 10.10(Yosemite,未检查Mavericks)上,您可以通过默认活动监视器应用程序按进程获取打开文件的列表.只需双击列表中的相关进程,然后在弹出窗口中选择打开文件和端口"选项卡即可.

At least on OSX 10.10 (Yosemite, didn't check on Mavericks), you can get the list of open files by process via the default activity monitor application. Just double click on the relevant process on the list and select "Open Files and Ports" tab on the popup.

提示:该窗格上的cmd + f快捷方式允许在内容上进行搜索和突出显示.

Tip: cmd+f shortcut on that pane allows for searching and highlighting on the content.

这篇关于获取OS X中打开的文件(描述符)列表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆