Asides
Get disk usage information for MySQL databases
Ever wonder how much space your MySQL database uses? Here you go:
SELECT table_schema "Database", SUM( data_length + index_length ) / 1024 / 1024 "MB used", SUM( data_free ) / 1024 / 1024 "MB free" FROM information_schema.TABLES GROUP BY table_schema;
Batch optimize images in bash
find . -type f -exec convert {} -resize 700×700> {} ;
Find all files recursively and give them a different extension
find . -name “*.mp3” -exec rename .mp3 .mp3srbad {} ;
Watch mysql processlist in (almost) real time
watch -n 1 “mysql -h 10.0.0.1 -u username -pPASSWORD -e ‘SHOW PROCESSLIST;'”
Keep tabs on memory usage (in real time)
watch -n 1 “free -ml”
Deadly process watch
ps -eo pcpu,pid,user,args | sort -k 1 -r | head -10
Chmod only directories recursively
find /path/you/want -type d -exec chmod 533 {} ;
Chmod only files recursively
find /path/you/want -type f -exec chmod 644 {} ;