Cent 7 - Find Grep and Set

Empty all .log files within /var/www

find /var/www -name '*.log' -exec /bin/sh -c '> "{}"' \;

Find files:

find / -type f -name [ ]
find / -size +1024M
find / -type d -name "[ ]" -ls

Get file and folder sizes:

du -sh *

Find the perms of an existing file:

stat --format=%a /[ ]

Grep:

grep -R "[ ]" /
grep -RL "[ ]" /
grep -R --include=*[ ] "[ ]" /
grep -R --exclude=*[ ] "[ ]" /
grep -Rl '[ ]' /[ ] | xargs grep -l '[ ]'
grep -Rl --include=*.[ ] 'none' /[ ] | xargs grep -l '[ 1 ]' | xargs grep --color -e 'info' -e '[ 2 ]' /dev/null

Find a dependency

yum provides \*/[ ]n

Find all files (in root) ending in .pl and make them executable:

find / -type f -name *.pl -exec chmod +x {} \;

Find all files with php file extension located in /var modified between 5 and 15 days ago containing the word ‘span’:

find /var -type f -name \*.php -mtime -15 -mtime +5 -print0 | xargs -0 grep -l span

Check PHP-FPM is running in chroot

ps -ax
ls -la /proc/[pid]/root/