Hi,
Can anyone explain me the difference between fsuer and lsof commands. As per my knowledge both the commands are used to find the processes used by the current file system or user. Apart from that what is the major difference between these commands
If you read the man pages for each of the two commands you will quickly see the differences. In general, use fuser for portability on POSIX systems because lsof is not available on all platforms.
fuser is kind of akin to pgrep, in that it finds processes holding open the files you name. It even has options to kill the processes it finds.
lsof is more general. By default it lists everything. It can't kill things by itself but can produce terse output that can easily be piped into things which do ( ... | xargs kill )
[edit] Okay, fuser's probably more portable then. Neither of these applications come standard AFAIK however.
Fuser has been standard with Solaris for as long as I can remember. There's been kernel support in Solaris for it, too. Look in '/usr/include/sys/utssys.h', IIRC.