The other day, Oskar Karlin asked me how and when I use the OS X Terminal app instead of e.g. the Finder. I’m not by any means a hard core command line guy but ther are often and often situations where the Terminal is faster or/and easier to use for the specific thing.

  • To resize all PNG-images in the current folder to 600px width
    find . -name "*.png" -type f -exec sips --resampleWidth 600 {} \;

  • To put in a “.thumbnail” in the file name
    for file in *.png; do mv $file ${file/.png/.thumbnail.png}; done

  • When I needed to know how many tracks we (Pluxemburg) sent to ITMS
    `find Music/iTunes\ Producer/Playlists -name metadata.xml -exec grep “

” {} \; | wc -l`

  • Copy a file to our Burnfield server (instead of launching a FTP-client)
    scp myfile burnfield@bidwell.textdrive.com:

  • Basic, but to view the apache error log
    tail /var/log/httpd/error_log

  • To view the source of this site’s feed
    curl "http://burnfield.com/martin/feed" | head

  • And how FeedBurner gets it
    curl --user-agent FeedBurner "http://burnfield.com/martin/feed" | head