Listening to music is a great way to relax and enjoy your time on a Linux system. If you’re tired of manually selecting songs, why not try playing random music? In this tutorial, we will explore different methods and tools to play random music in Linux.

Method 1: Using the Command Line

One of the simplest ways to play random music in Linux is by using the command line. Follow these steps:

  1. Open the terminal on your Linux system.
  2. Navigate to the directory where your music files are stored using the cd command.
  3. Use the ls command to list all the music files in the directory.
  4. Copy the file names and paste them into a text editor.
  5. Randomly select a file name from the list.
  6. Use a media player command, such as mplayer or vlc, followed by the selected file name to play the random music .

By following these steps, you can easily play random music using the command line in Linux.

Method 2: Using a Music Player with Random Playback

If you prefer a graphical user interface (GUI) approach, you can use a music player that supports random playback. Here are a few popular options:

Music Player Random Playback Feature
Rhythmbox Go to the “Library” tab, select the desired playlist or library, and click on the shuffle icon.
Clementine Click on the “Play” menu, select “Shuffle,” and choose the desired playlist or library.
Amarok Go to the “Collection” tab, select the desired playlist or library, and click on the shuffle icon.

These music players provide a user-friendly interface to play random music in Linux. Simply select the desired playlist or library and enable the random playback feature.

Method 3: Using a Command Line Music Player

For those who prefer a command line interface, there are also dedicated command line music players that support random playback. One popular option is MPD (Music Player Daemon). Here’s how you can use it:

  1. Install MPD on your Linux system using the package manager.
  2. Configure MPD by editing the mpd.conf file.
  3. Add your music directory to the mpd.conf file.
  4. Start the MPD service.
  5. Use a client program, such as ncmpcpp, to connect to the MPD server.
  6. Select the random playback mode in the client program.

With MPD and a command line client, you can enjoy random music playback in Linux directly from the terminal.

Frequently Asked Questions (FAQs)

Here are some common questions about playing random music in Linux:

1. Can I play random music from a specific genre?

Yes, you can. Most music players allow you to create playlists based on genre. Once you have a playlist for a specific genre, you can enable the random playback feature to play random music from that genre.

2. Can I play random music from multiple directories?

Yes, you can. In the command line method, you can use the find command to list music files from multiple directories. In the music player method, you can add multiple directories to your library or playlist.

3. Can I control the randomness of the music playback?

Yes, you can. Some music players offer different modes of random playback, such as shuffle or random, which control the randomness of the music playback.


Playing random music in Linux is a fun way to discover new songs and enjoy a variety of music. Whether you prefer the command line or a graphical interface, there are multiple methods and tools available to suit your preferences. Try out the different approaches mentioned in this tutorial and find the one that works best for you. Happy listening!