Archive for the 'Shell tricks' Category

Unixtrix: Backup

Friday, February 1st, 2008

I back up my files remotely using rsync. For the Mac Erin and I share, on which we keep gobs of pictures, video, and the like, that’s not feasible given our limited bandwidth. Erin is good at archiving files to DVD, but it’s time consuming. So we established a quick and dirty way to keep [...]

Unixtrix: dump URL to a local file

Sunday, December 2nd, 2007

curl -O -C - http://wrecking.org/404.jpeg
wget -c http://wrecking.org/404.jpeg
Context:
Someone emailed me a nifty Flash object, and I wanted a copy.
Explanation:
These commands do the same thing: grab the URL indicated and dump it to a local file with the filename used on the remote server. So the URL above becomes 404.jpeg in the local directory. (For curl, this [...]

Unixtrix: Word frequency in plaintext

Saturday, November 17th, 2007

perl -pe “tr/[A-Z]/[a-z]/; s/[\!\/\[\];?\’\”,\-\$\.\(\)]/ /gs; s/ +/\n/g;” < sotu2007.text | sort | uniq -c | sort -nr > sotu2007freq.text
Context:
David Banash and I wanted to see what issues are on the radar at WIU, based on the content of Big Al’s State of the University speech. I pasted the speech content from the web to [...]

Unixtrix: calculate size of all files of given extension

Friday, November 16th, 2007

find . -name “*.AVI” -print0 | xargs -0 du -ch
Context:
cleaning up Erin’s Mac (more on that soon), I want to find out how much space is taken up by iPhoto movie files. iPhoto has crappy search features (read: none). So, cd ~/Pictures and then run the command above. (Answer: 26 GB.)
Explanation:
find by name [...]