"lsof" shows a file as (deleted) but I can still see it in file system

user1783732 picture user1783732 · Aug 13, 2013 · Viewed 25.2k times · Source

in Linux 2.6.27:

From "lsof" output I see a process holding open fd with a (deleted) file. The strange thing is that I can still see the file in the file system using "ls". Why is that?

thanks.

Answer

fefe picture fefe · Nov 20, 2013

When a file is deleted it would not been seen on the file system. However, it is quite possible another file with the same file name is created on the same location.

You can check the node number shown in lsof and ls -i to check whether they are really the same file.