I try to collect as many practical and functional command-line applications as I can. And yet more and more frequently, it seems that much of what I want to get done doesn’t need an actual “application.”
As an example, I recently (and once or twice before, in the past) needed to convert between audio file formats, mostly because I prefer ogg files, but also just because m4a support is more work than it’s worth. 🙄
Each time it becomes important I make a quick run through the Internet, looking for something that looks like a comprehensive, console-based application that can convert between audio formats. And every time, the Internet spits out a page with this on it.
for nam in *.mp4; do nice mplayer -ao pcm "$nam" -ao pcm:file="$nam.wav" && nice oggenc -q5 "$nam.wav" -o "$(basename "$nam" .mp4).ogg"; rm "$nam.wav"; done
As you see it, it’s not really going to do the job, but with a few small adjustments — change the file type at first, and maybe the quality level — it suddenly becomes the perfect audio file converter. With mplayer and vorbis-tools already on board, it requires no extra dependencies, no obscure libraries and no more effort than it takes to copy that line into the terminal.
And the results are indistinguishable from what I might get from any “application” that’s out there. Of course, I have to admit, after finding that one-line solution, I didn’t look around much longer. 😉