Mplayer Shuffle Command: Play Files In Random Order

by on October 1, 2011 · 14 comments· last updated at October 1, 2011

How do I play files in random order using the mplayer command line player under Linux / Unix operating systems?

You can play most files such as MPEG/VOB, AVI, ASF/WMA/WMV, RM, QT/MOV/MP4, Ogg/OGM, MKV, VIVO, FLI, NuppelVideo, yuv4mpeg, FILM and RoQ files in random order using the following command syntax:

 
mplayer -shuffle -playlist YOUR-PLAY-LIST-HERE
 

How Do I Generate a Playlist?

mplayer can play files according to a playlist file type such as ASX, Winamp, SMIL, or one-file-per-line format. You can use the find command to generate a playlist for mplayer:
$ cd /path/to/music/dir
$ find -type f -iname \*.mp3 > playlist.txt

mplayer Shuffle Mode Command

Type the following command:
$ mplayer -shuffle -playlist playlist.txt



You should follow me on twitter here or grab rss feed to keep track of new changes.

Featured Articles:

{ 14 comments… read them below or add one }

1 Dougle October 2, 2011 at 2:36 pm

Hey look! it’s the bottom of the barrel! I wondered when we would run out of linux commands.

Reply

2 collin October 10, 2011 at 7:50 pm

Open a terminal and cd to the directory that has the music files you want to play. next type “mplayer *.*” press enter. Enjoy!!!!

Reply

3 ari November 4, 2011 at 6:50 am

Now, what if i want to skip to the next song? what is the shortcut?

Reply

4 ari November 4, 2011 at 6:56 am

no problem, press enter will bring me to the next song.
Thank you :D

Reply

5 Vivek Gite November 4, 2011 at 9:26 am

You can also press > and <

Reply

6 Dinesh Mali December 12, 2011 at 6:30 pm

Great tips!! Thanks for this beautiful post

Reply

7 joshua January 3, 2012 at 9:13 am

how do I enqueue another song while one is already playing?

Reply

8 Leo June 24, 2012 at 4:35 pm

If only I had found this post earlier…
Great post! Thanks!

Reply

9 donatom July 7, 2012 at 6:01 pm

Vivek:

I have been wondering how to do what you so wonderfully explained for many years!
Thanks for your help — and thanks for helping the whole Linux/Gnu community!

Reply

10 know all October 22, 2012 at 2:54 pm

‘mplayer *’ will do. Perhaps *.* is a relic from dos times :)

Reply

11 Joshua October 23, 2012 at 12:37 am

relic, lol, I miss dos.. Found another one tho! mplayer */* for your whole collection, it will do all in this directory, and all in one directory down.. I’ve also used mplayer */*/* to play two folders down.. =]

Reply

12 PJ Brunet January 8, 2013 at 6:49 pm

I bet there’s a way to do this without making a playlist.

Reply

13 Anonymous March 30, 2013 at 3:08 am

Seems to work with regular filelists, e.g. mplayer -shuffle * will play files in the current directory in a random order.

Reply

14 PJ Brunet March 30, 2013 at 7:22 pm

Thanks Anonymous, that works for me!

Reply

Leave a Comment

You can use these HTML tags and attributes for your code and commands: <strong> <em> <ol> <li> <u> <ul> <kbd> <blockquote> <pre> <a href="" title="">

Tagged as: , , , , , , , , , , , , , , , , , ,

Previous Faq:

Next Faq: