June 18th, 2010

Resizing many images at once with ImageMagick, also setting ouput quality:
  1. convert -quality 95 '*.jpg[400x600]' pic%03d.png

Top 10 files that are consuming most hard drive space in /var:
  1. du -a /var | sort -n -r | head -n 10

Finding files and executing a command on them:
  1. find . - name 'Name*' -exec ls -l {\}\ \;

Recursively changing directory and file rights:
  1. find . ! -type d -exec chmod 644 {} \;
  2. find . -type d -exec chmod 755 {} \;

Recursively deleting files from a directory:
  1. find . -type f -exec rm {} \;

Recursively removing .svn folders from a dir:
  1. find /path/to/destdir -name '.svn' -exec rm -r {} \;

Changing filename suffixes:
  1. for f in *.JPG; do mv $f `basename $f .JPG`.jpg; done;