How to traverse all file struct

Valdis.Kletnieks at vt.edu Valdis.Kletnieks at vt.edu
Mon Apr 27 21:57:19 EDT 2015


On Tue, 28 Apr 2015 00:58:47 -0000, cmqycmqy said:
> (Again, depending I just want to print process info whitch have open a
> specific file£¨inode£©. Then if i want to delete a file in use,i can just kill
> the process one by one.

No kernel hacking needed for that, you can do it in userspace.

# lsof | grep /your/file/here
# kill -9 ` lsof | grep /your/file/here | awk '{print $2} |uniq '`
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 848 bytes
Desc: not available
Url : http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20150427/f756e032/attachment.bin 


More information about the Kernelnewbies mailing list