Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

5
  • 3
    There's also a truncate command that does the same thing more explicitly. Commented Mar 20, 2013 at 9:15
  • nope, even as root: AIX 6.1, lsof 4.82 : doesn't show the filename. instead, using procfiles -n pid instead of lsof -p pid will show the filename, UNTIL you delete it (ie, after deletion, it still shows its other informations, inode, modes, etc, but the things -n was showing (ie: its full path : name:.........) is no longer shown once the corresponding file is deleted). So please if anyone knows a solution for AIX 6.1, I'm interrested. Commented Mar 20, 2013 at 13:40
  • 2
    @OlivierDulac, lsof is probably going to be the closest to a portable solution you can get to list open files. the debugger approach to close the fd under the application feet should be quite portable as well. Commented Mar 20, 2013 at 13:50
  • 2
    @StephaneChazelas: thanks. I found a way to list all PIDs which have a file open on each partitions : df -k | awk 'NR>1 { print $NF }' | xargs fuser -Vud (and then easy to send signals to the offenders to force them to release the fd) Commented Mar 20, 2013 at 18:56
  • 10
    You can also use lsof +L1. From the lsof man page: "A specification of the form +L1 will select open files that have been unlinked. A specification of the form +aL1 <file_system> will select unlinked open files on the specified file system.". That should be a bit more reliable than grepping. Commented Oct 23, 2014 at 6:26