linux
Finding Who Has A File Open
Filed in archive by Michael Hammer 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 
Trackback: http://publish.creative-weblogging.com/publish/mt-tb.pl/34402
img Addthis img Ask img Blinklist img del.icio.us img Digg img Fark img Facebook img Google img Lycos img Ma.gnolia Add this page to Mister Wong Mr Wong img Netscape img Netvousz img Newsvine img Reddit img StumbleUpon img Slashdot img Tailrank img Technorati img Wink img Yahoo

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.
 
Subscribe
Share It
RSSrss
See all blog subscribe options
Google google
What is RSS?
Yahoo! yahoo
Addthis Subscribe using any feed reader!
Bloglines Bloglines
Newsletter

TwitterFollow us on Twitter!