大网数据广告活动
服务器运维问答

lsof runs very slow in my server

· 52CE 我爱测

I'm running lsof in one of my Linux server to check if one file ( /tmp/incoming_data.txt ) in the ext3 system is opened by other programs. My server has lots of TCP connection on it. The weird thing is the execution of 'sudo lsof…

问题原文

原帖链接 · James Gan · CC BY-SA 3.0

I'm running lsof in one of my Linux server to check if one file (/tmp/incoming_data.txt) in the ext3 system is opened by other programs. My server has lots of TCP connection on it. The weird thing is the execution of 'sudo lsof' takes about two minutes to finish and it uses 99.x% CPU during that two minutes.

The command I used is sudo lsof /tmp/incoming_data.txt. I've tried "fuser" which takes about the same amount CPU and execution time. Is there anything I can do fix this problem?

已采纳解答

原帖链接 · Daniel t. · CC BY-SA 3.0

If you are certain that you can skip the open TCP or UDP connections, since you mentioned there are too many of them, you can use the dialect-specific option of lsof -X.

lsof -X

Read the man page of lsof and search for '-X' for detailed information.

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2015-03-20)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 3.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。