Skip to content

Instantly share code, notes, and snippets.

@cweiland
Created March 6, 2020 08:46
Show Gist options
  • Save cweiland/48e50dce8aa859c8d6327ab5a7908fd9 to your computer and use it in GitHub Desktop.
Save cweiland/48e50dce8aa859c8d6327ab5a7908fd9 to your computer and use it in GitHub Desktop.
#!bin/bash
for pid in `lsof +L1 | grep deleted | awk '{print $2}' | uniq`
do
for fdid in `ls -l /proc/${pid}/fd | grep deleted | awk '{print $9}'`
do
> "/proc/${pid}/fd/${fdid}"
done
done
@cweiland
Copy link
Author

cweiland commented Mar 6, 2020

Really useful when you have deleted an processlocked file

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment