Table of Contents

FIND

SHRED

find . -name '*filename*' | xargs shred -v -n 2 -z -u

REMOVE SPACES

find -name '*filename*' -exec rename -v ' ' _ {} \;

All files modified today

find / -path /proc -prune -o -path /sys -prune -o -type f -newermt "$(date +%Y-%m-%d)" -ls|more
find / -mount -mtime -1 -ls |sort -k 11 |less

FILES NOT OWNED BY APACHE FORMATTED

# find data/ \! -user apache -printf "%u \t %g \t %t \t %s \t %h%p \n"

MULITPLE FILENAMES

# find . \( -iname \*40785\* -o -iname \*40791\* -o -iname \*40806\* \) -exec ls -l {} \;

SPECIFIC PERMS

# find . -type d -perm +g=x \! -perm +g=w \! -user apache -exec chmod g+w {} \;
# find . -group pr -type f \! -perm +u=w -exec chmod u+w {} \;
# find . \! -perm +a=r -exec ls -ld {} \; 
# find apps/ -type d -exec ls -ld {} \; | less

FIND AND CORRECT PERMS

# find apps/ -type d -exec chmod g+w {} \;
# find apps/ -type d -exec chmod g-s {} \;

WITH EXCLUDED PATHS

# find . -path './data' -prune -o -path './logs' -prune -o -type f -exec grep -iHn "ecu.edu.au" {} \; |less

WITH EXCLUDED FILES FORMATTED

# find cache/ ! \( -name "sess_*" \) -ctime 1 -printf "\t%s \t %a \t %h%p \n"
# find cache/ ! \( -name "sess_*" \) -mmin 700 -printf "%t \t %s \t %h%p \n" 2>/dev/null

SIZE OF FOLDERS/FILES IN A SINGLE FOLDER

# find /var/log/ -maxdepth 1 -exec du -s {} \; |sort -n

FILES CHANGED IN THE LAST 24 HOURS AND PRINT FORMATTED

# find . -type f -ctime 1 -printf "\t%s \t %a \t %h%p \n"

FILES WITH GROUP STICKY BIT SET

# find . -perm 2775 -printf "%m %g" -exec ls -d {} \;
# find . -maxdepth 2 -perm -2000 -type d -printf "%m \t %u \t %g \t" -exec ls -d {} \;

FIX DIRECTORIES WITH STICKY BIT SET

# find . -type d -exec chmod g-s {} \;