Sign up ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. It's 100% free, no registration required.

Both shows the number of files we're using.

Yet they both shows different results.

root@host [~]# lsof /home4
root@host [~]# lsof /home2
root@host [~]# lsof /home4

Then we got

fuser -uvm /home4

                     root       2621 Frce. (root)crond
                     root       2635 Frce. (root)atd
                     root       4554 frce. (root)S99firstboot
                     root       4768 .rce. (root)firstboot
                     root       6533 .rce. (root)setup
                     root      11042 Frce. (root)leechprotect
                     root      11049 Frce. (root)httpd
                     root      17885 Frce. (root)httpd
                     root      18163 .rce. (root)sshd
                     root      18184 .rce. (root)bash
                     nobody    18619 Frce. (nobody)httpd
                     nobody    18679 Frce. (nobody)httpd
                     nobody    18812 Frce. (nobody)httpd
                     nobody    18821 Frce. (nobody)httpd
                     nobody    18841 Frce. (nobody)httpd
                     nobody    18843 Frce. (nobody)httpd
                     nobody    18850 Frce. (nobody)httpd
                     nobody    18869 Frce. (nobody)httpd
                     nobody    18885 Frce. (nobody)httpd
                     nobody    18901 Frce. (nobody)httpd
                     nobody    18914 Frce. (nobody)httpd
                     root      18932 .rc.. (root)flush-7:0
                     root      30728 Frce. (root)cphulkd
                     root      30756 Frce. (root)cpsrvd-ssl
                     root      30806 Frce. (root)cpdavd
                     root      30833 .rce. (root)queueprocd
                     root      30904 Frce. (root)tailwatchd
                     root      30913 Frce. (root)cpanellogd

Where did I went wrong?

share|improve this question

2 Answers 2

up vote 6 down vote accepted

The usage of the two are different.

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

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.

share|improve this answer
so why fuser -uvm /home4 shows many entry and lsof shows none? – Jim Thio Jan 7 '13 at 12:00
You missed the -- before /home4. – John Siu Jan 7 '13 at 12:56

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.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.