Useful *nix shell commands

Find in files

  find * -exec grep -l 'pattern' {} \;
  or
  grep -R -i pattern *

Find a file and execute a specific command:

  find path conditions -exec command {} \;
  e.g.
  find ./ -name “*.php” -exec cat {} \;

Make and burn CD/DVD from folder (OS X)

  hdiutil makehybrid foldername -o volumename.iso
  hdiutil burn -noverifyburn volumename.iso 

Archive copy (only copy newer files), maintaining file dates, attributes, etc... (use GNU cp). sourcefolder will end up in destinationfolder/sourcefolder

  gcp -dpRuv sourcefolder destinationfolder