1823813 Members
3681 Online
109665 Solutions
New Discussion юеВ

lsof vs fuser

 
SOLVED
Go to solution
chakri
Occasional Contributor

lsof vs fuser

Which command is best to find if the file is still open?? lsof or fuser. which command will take more cpu??
4 REPLIES 4
Ivan Ferreira
Honored Contributor
Solution

Re: lsof vs fuser

About cpu usage for sure lsof, but is really great.

Last time I had a problem with a file system near full. But if you do du over the file system, the information does not match. The problem was a file already deleted, but not released by the process.

I have a "screenshow" of that!!!

COMMAND PID USER FD TYPE DEVICE SIZE NODE NAME
java 7699 oas 22u REG 253,1 856117248 59 /tmp/dat000407699 (deleted)

800 MB in a "ghost" file was found with lsof.
Por que hacerlo dificil si es posible hacerlo facil? - Why do it the hard way, when you can do it the easy way?
chakri
Occasional Contributor

Re: lsof vs fuser

thank you
Stuart Browne
Honored Contributor

Re: lsof vs fuser

It depends on what information you want to get.

As for how much CPU, we're talking milliseconds of difference in favour of fuser.

Now, regarding usefulness, I'm an lsof fan, no question.

But as I said, it depends on what information you want.
One long-haired git at your service...
dirk dierickx
Honored Contributor

Re: lsof vs fuser

wow, who cares about the cpu usage of such a tool, unless you want to put it in cron and run it every 2 minutes it doesn't matter!