Play your entire music collection – Mplayer One Liner

Sometimes just plain lazy, and want just to play music. Run this command in the background (ALT+F2) or in a terminal for playback of all your mp3/ogg/m4a/wma, shuffled, looped, normalised. What’s nice about this is that the shuffle algorithym does a good job and with a large collection of music you don’t get repeats. I found that trying the same thing with vlc meant the shuffle was  always the same, and so you always started with the same music. :( Anyway the one-liner:

find ~/Music ( -iname “*.mp3” -o -iname “*.m4a” -o -iname “*.ogg” -o -iname “*.wma” ) -exec mplayer -nocache -af volnorm -shuffle -loop 0 ‘{}’ + &

Change “~/Music” to suit.

Even better put this in a script, and link to a keyboard shortcut, or add to your startup?

Now running the one liner from a terminal takes a bit of stopping, you’ll need to CTRL+C a couple of times in quick succession to close find then mplayer. Or you can run another one-liner:

killall -15 find mplayer

If you run the command from a script, you’ll have to shut down the script first, and then kill off the running instances of find and mplayer. Best to also do this from a script as well. Say the script you use to run is called, let’s create another called which contains:


killall -15
killall -15 find
killall -15 mplayer

I am sure someone clever could bind this all together in one script, based upon a keyboard shortcut toggle or something…

Leave a Reply

Your email address will not be published. Required fields are marked *