How do you make a universal playlist from a directory of mp3 files?

This question came up as my wife is a musician (violinist) and she has a gig, and the DJ at the event will be playing her accompanying music for her. He told her to bring a thumbdrive with her music on it. She asked me to help her make a playlist. Since I don't know what sort of operating system the DJ has or will be using, I need a universal format, and I need to accomplish this without expending a great deal of effort.

Googling did not provide me with answers, even when I added Ask Ubuntu to the search.

So the question is:

How do you make a universal playlist from a directory of mp3 files?

Note that after writing this up, I found How can I generate an M3U playlist from the terminal?, but the use-case is different (requiring a different answer as well), and the question being asked here is not aware of the existence of m3u.

2 Answers 2


How to make a playlist from a directory of mp3 files?

cd to the directory and

ls -1 *.mp3 > playlist.m3u

It turns out that there exists a fairly universal format called m3u format, and it can be as simple as a list of filenames separated by newlines.

After my wife had moved the mp3 files she wanted onto an empty thumb drive, I opened a terminal, browsed to the media directory, and typed the following and hit enter:

ls -1 *.mp3 > playlist.m3u

I then opened the file for her in gedit and let her copy and paste the lines around as much as she wanted to get them into her desired order.

When she was done, she saved the file, double-clicked it in a folder browser, and RhythmBox opened it. She clicked play, and it played, and I was a hero.


Shuffle Playlist

Bash script example for Pi Musicbox with USB HDD (generatePlaylist.sh)...

find /music/USB/mp3/* -iname *.mp3 -type f | shuf | head -n 200 > /music/playlists/mp3_shuffle.m3u

combined with crontab job to run every 4 hours...

0 */4 * * *     root    /music/playlist/generatePlaylist.sh

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.