Created
October 12, 2014 12:31
-
-
Save theirix/4b062b494db52342c6eb to your computer and use it in GitHub Desktop.
Locate orphaned files in etc
This file contains 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
#!/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