create new tag
, view all tags
lsof (LiSt Open Files) -- shows open files, network ports, and UNIX domain sockets on a Linux system.

See AboutThesePages.

Did you ever try to unmount a filesystem and fail because umount tells you that it is still in use?

So you logout from all Your virtual consoles which might have their current directory somewhere along the path.

You close all your programs who might access the filesystem.

But still you cannot unmount.

lsof gives you a list with all the open files in the system.

$ lsof | grep <YourFilesystemsDirectory>

will give you the process IDs of all programs accessing files on the filesystem you want to get rid of. And then you can take action to close those files. (You might want to look up 'man kill' wink



From: TechRepublic Presents your LINUX E-NEWSLETTER for July 30, 2002

When you try to unmount a filesystem and are denied with a Filesystem Busy message, use lsof to determine what process is holding onto the mountpoint. For example:

# /usr/sbin/lsof /mnt/cdrom

In this case, /mnt/cdrom is the mountpoint in question, and lsof will tell you if any processes have opened any files on that particular filesystem.

You can also use lsof to find open network connections by giving it the "-i" parameter. If you prefix this with an IP address, you can find all open network connections to or from the specific IP address or domain name. For instance:

# /usr/sbin/lsof -i@10PLEASENOSPAM.0.35.8

This command will display all open network connections to or from the IP address

List all open TCP connections by using:

# /usr/sbin/lsof -i tcp

Normal users can use lsof to list all open files, but there are restrictions to the information they can obtain.


See ResourceRecommendations. Feel free to add additional resources to these lists, but please follow the guidelines on ResourceRecommendations including ResourceRecommendations#Guidelines_for_Rating_Resources.


  • (stw) man lsof --
  • (stw) man kill --
  • (rhk) [[][]] --

<Currently, no significant content below this line.>

Recommended for Specific Needs

  • (rhk) [[][]] --

Recommended by Others

  • (rhk) [[][]] --

No Recommendation

  • (rhk) [[][]] --

Not Recommended

  • (rhk) [[][]] --


  • (stw) StefanWaidele - 09 Jul 2002
  • <If you edit this page: add your name here; move this to the next line; and include your comment marker (initials), if you have created one, in parenthesis before your WikiName.>


Page Ratings

Edit | Attach | Watch | Print version | History: r4 < r3 < r2 < r1 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r4 - 2002-07-30 - RandyKramer
  • Learn about TWiki  
  • Download TWiki
This site is powered by the TWiki collaboration platform Powered by PerlCopyright 1999-2017 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding WikiLearn? WebBottomBar">Send feedback
See TWiki's New Look