Find Stuff

fdupes --recurse dir1/ dir2/ 
grep -rnw '/path/to/files/' -e "pattern"
find / -type s
find . -type f -printf '%T@ %P\n' | sort -n | awk '{print $2}'
du -h * | grep '^\s*[0-9\.]\+G'

Change 'G' to 'M' for MB output.

Differences

diff -y file1 file2 | less
diff <(ls -a /dir1/) <(ls -a /dir 2/)

or compare

comm <(ls -a /dir/) <(ls -a /dir2/)


Maintenance

kill $(ps aux | grep "$process_term" | grep -v 'grep' | awk '{print $2}')
cat /dev/null > modsec_audit.log

See also “log rotate” on mL wiki.

rm -rf !(filename)

This works only if extglob is enabled. So

shopt -s extglob


Compression

time xz -6ve -k --threads=0 <filename>
xz file1.txt file2.txt file3.txt
xz -d file.txt.xz
unxz file.txt.xz
xz -tv <filename>.tar.xz
xzip -c file1.txt > files.xz
xzip -c file2.txt >> files.xz
xzcat test.txt.xz
 test
 example
 text
xzgrep exa test.txt.xz
 example

PHP

php -r "print phpinfo();" | grep ".ini"

or

php -i | grep in


apt-get install --reinstall `dpkg -l | grep 'ii  php7' | awk '{ printf($2" "); next}'`

Log Analysis

* limiting by date range

sed -n '/8\/Oct\/2019/,/8\/Oct\/2019/ p' access.log