Skip to content

Instantly share code, notes, and snippets.

@theirix
Created October 12, 2014 12:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save theirix/4b062b494db52342c6eb to your computer and use it in GitHub Desktop.
Save theirix/4b062b494db52342c6eb to your computer and use it in GitHub Desktop.
Locate orphaned files in etc
#!/bin/bash
find /etc -type f | while IFS= read -r line ; do
[ $(echo "$line" | grep -E "^/etc/.git/") ] && continue
[ $(echo "$line" | grep -E "^/etc/selinux/") ] && continue
dlocate -S "$line" >/dev/null
if [ $? != 0 ] ; then
if [ "$(apt-file search -l \"$line\" | wc -l)" = "0" ] ; then
echo $line -- $(stat -c '%y' $line | cut -f1 -d' ')
else
echo $line -- dpkg miss, apt-file hit
fi
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment