Created
February 14, 2015 00:40
-
-
Save zertrin/28c2d8815785a525293f to your computer and use it in GitHub Desktop.
Find obsolete libs used by processes
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function find-obsolete() { | |
local pid cmd file | |
for pid in $(\grep '(deleted)' /proc/*/maps | \grep -v '/dev/zero' | cut -d/ -f 3 | sort -un); do | |
cmd=$(ps -o comm -p $pid | tail -n 1) | |
for file in $(\grep '(deleted)' /proc/$pid/maps | \grep -v '/dev/zero' | awk '{print $6}' | sort -u); do | |
echo "$pid $cmd $file" | |
done | |
done | column -t | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment