moodLearning Wiki

This is an old revision of the document!


Find Stuff

  • looking for duplicate filenames in 2 directories
fdupes --recurse dir1/ dir2/ 
  • find a word in a file
grep -rnw '/path/to/files/' -e "pattern"
  • find all socket files your system runs
find / -type s

Differences

  • between files, showing side by side
diff -y file1 file2 | less
  • differences of files between directories
diff <(ls -a /dir1/) <(ls -a /dir 2/)

or compare

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


Maintenance

  • kill a process wholesale
kill $(ps aux | grep "$process_term" | grep -v 'grep' | awk '{print $2}')
  • trim log. example:
cat /dev/null > modsec_audit.log

See also “log rotate” on mL wiki.

PHP

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

or

php -i | grep in