What's the difference between lsof and fuser -uvm

The usage of the two are different.

For lsof, to show opened files for certain path only, put -- in front of first path specified:

lsof -- /home4
lsof -- /home4 /home2

lsof will show all opened file containing the path.

For fuser, on the other hand, show process opening the file you specified

fuser -uv <filename> 

To show processes accessing a particular path, use -m

fuser -uvm /home3

fuser is more useful in identifying process id opening a particular file.

lsof is useful to find out all file(s) opened by particular process.


This is not 100% correct. The string "--" is used only once after the options and before the list of paths, i.e.

lsof [options] [--] [names]

The following command

lsof -- /home4 -- /home2

would give an error unless a file named "--" existed in the current directory.

This one should be fine

lsof -- /home4 /home2

In general "--" means "end of options" and is used by the shell. So if you use some parameter (like a file name) that starts with a hyphen then you will need to use "--" so that the parameter will not be passed as an (invalid) option flag. It will be translated as a parameter.

Tags:

Process

Lsof