# Difference between fuser and lsof command

**URL:** <https://community.unix.com/t/difference-between-fuser-and-lsof-command/325636>\
**Category:** Solaris\
**Created:** [March 13, 2013, 9:32am UTC](https://community.unix.com/t/difference-between-fuser-and-lsof-command/325636 "2013-03-13T09:32:23Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![system](https://community.unix.com/uploads/default/original/2X/c/c7e9e16a595259edafe88615719d5c5dcda035c2.png) [@system](https://community.unix.com/u/system)\
**Post date:** [March 13, 2013, 9:32am UTC](https://community.unix.com/t/difference-between-fuser-and-lsof-command/325636/1 "2013-03-13T09:32:23Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![fpmurphy](https://community.unix.com/user_avatar/community.unix.com/fpmurphy/32/110_2.png) [@fpmurphy](https://community.unix.com/u/fpmurphy)\
**Post date:** [March 13, 2013, 11:36am UTC](https://community.unix.com/t/difference-between-fuser-and-lsof-command/325636/2 "2013-03-13T11:36:52Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Corona688](https://community.unix.com/letter_avatar/corona688/32/6_449c533f586939b6e5f246632a46421f.png) [@Corona688](https://community.unix.com/u/Corona688)\
**Post date:** [March 13, 2013, 11:40am UTC](https://community.unix.com/t/difference-between-fuser-and-lsof-command/325636/3 "2013-03-13T11:40:52Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![achenle](https://community.unix.com/letter_avatar/achenle/32/6_449c533f586939b6e5f246632a46421f.png) [@achenle](https://community.unix.com/u/achenle)\
**Post date:** [March 13, 2013, 11:59am UTC](https://community.unix.com/t/difference-between-fuser-and-lsof-command/325636/4 "2013-03-13T11:59:30Z")

</div>

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.
