当Chromium或Firefox打开时,lsof运行会非常缓慢

我有一个脚本,在我的笔记本电脑上运行lsof(Ubuntu Natty),每隔一段时间检查一下。 我最近注意到,当我打开Chromium或Firefox时,它运行得非常慢。

无铬打开:

$ lsof | wc -l 5288 

附:

 $ lsof | wc -l 5721 

无:

 $ time lsof > /dev/null real 0m0.134s user 0m0.080s sys 0m0.040s 

附:

 $ time lsof > /dev/null real 0m20.250s user 0m0.080s sys 0m0.070s 

在查看浏览器的条目时,lsof似乎“卡住”了。

我只是好奇它为什么会发生,如果有办法的话。 build议?

试试-n选项:

-n此选项禁止将networking号码转换为networking文件的主机名称。 禁止转换可能会使运行速度加快。 主机名称查找不正常时,这也很有用。