linux

Finding Who Has A File Open

Filed in archive on August 26, 2006

How often do mounts and umounts fail because you can't determine what is using the device? How many Times can you not eject a CD because something's got it open? How many times have you experienced a "file browser" that keeps a directory open even after you've navigated out of that directory and clicked the "refresh" button? Who's got this thing open??? Use thefuserprogram to find out:
[slitt@mydesk slitt]$ /sbin/fuser -mu /d/d: 1693(slitt) 1891c(slitt) 1894 1894c(slitt) 1907 1907c(slitt) 1908 1908c(slitt) 1909 1909c(slitt) 1910 1910c(slitt) 1912 1912c(slitt) 1913 1913c(slitt)[slitt@mydesk slitt]$
You get the owner and the process ID. From there you can research usingps ax.
Be sure to look at the fuser man page for details on other info you can obtain. You can even kill all processes accessing a file, though I highly recommend against such a heavy handed move.



Permalink: Finding Who Has A File Open

Tags: linux  code  server  source  failure  open  finding+file  file+open 

Vote for Finding Who Has A File Open:

  • Currently 8.67/10
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
Rating: 8.67 out of 3 vote(s) cast.
 
Share It
RSSrss
Google google
Yahoo! yahoo
Addthis Subscribe using any feed reader!
Bloglines Bloglines
TwitterFollow us on Twitter!
Most Popular   Applications   Applicatios   Best of   Devices   Did you know   Education   Entertainment   Finding The Right Linux For You   FreeBSD   Hacks   Humor   Information About   Linux For Windows Users   Multimedia   Networking   News   OS   Programming   Securing   Servers