问题原文
原帖链接 · 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.
摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。
