command lsof

hello

Sorry but i don't understand very well the lsof command with the man.
Can you explain to me what is the use of this command ?

thank you

ls of command stands for "list open file systems". The command returns the user processes that are actively using a file system. It is sometimes helpful in determining why a file system remains in use and cannot be unmounted.

Theres also one more command "fsuer" used for doing the same thing.

The main difference between lsof and fuser is that lsof takes both files/filesystems and PIDs as arguments whereas fuser only accepts files/filesystems.

lsof will also do things that fuser can't, like show you who has TCP ports open, etc.

Where I find it useful is if I am going to unmount a filesystem, and it is not unmounting because it is currently "busy", I can see what processes have files open there, kill them off (or call up the owner), and then unmount it, etc. Unfortunately, NFS works at a low enough level that neither fuser nor lsof can see it. If you can't unmount /xyz because you exported it via NFS, it will be "busy" and won't unmount, but lsof won't tell you why.