If you’re a developer and use a Unix-like OS, you must be spending a good amount of time inside the shell. Here’s a nice, little tip on how to play Music with in the command line interface, in OS X.
OS X ships with a CLI utility called afplay. There’s not much documentation available, even the man page doesn’t show its options. But it’s there and more importantly, it works.
To use it, pass a Music file’s path in the command, like this:
afplay ~/Music/song.mp3
I guess it works for all Music files, regardless of the type (I tried it with .m4a and it worked fine). To stop the play, you can of course hit Ctrl + C and the shell will terminate it.
You can also play Music in background by appending an ampersand to the command, like this:
afplay ~/Music/song.mp3 &
This will allow you to use the shell while the Music is playing in background. To stop it, you can do killall afplay
.
You can also use Quicklook’s CLI to play Music files. The utility is named qlmanage
. It basically throws a Quicklook pop up of any file you pass as an argument. So it works fine for Music files too.
If you like this, you might want to take a look at some useful Quicklook plugins. Also, thanks to Rakshit Thakker for the tip!
2 Comments
Haha. Thanks for this nice and fun tip, Vibin. 🙂
Nice one 🙂