How To Play Music From Command Line (Terminal)

Most people like me prefer using Command Line in everyday life to Graphical User Interface (GUI) .

Today i`am going to show you how play music files from the Command Line using one of the best Command Line players (SoX) which supports most audio formats. Such as: wav, mp3, mpg, mp3, ogg, flac, etc.

SoX – Sound eXchange from the $ man sox  is described as , the Swiss Army knife of audio manipulation. 

Let’s get started, to install SoX:

1. Launch the terminal (Ctrl + Alt +T) type the command below and strike enter:

sudo apt-get install sox

sox_1

2. Input your password and  hit enter.

 sox_2

3. Type “y” without quotes and hit enter.

 sox_3

4.  After installation has been completed, run the command below to make SoX play .mp3 and other audio file formats.

sudo apt-get install sox libsox-fmt-all

 Sox_5

5. After the installation is done. Now you are ready to play any audio file from any directory.

 6. To play all .mp3 files in any directory, change directory and use this command:

play *mp3

 sox_6

7. To play a specific file, type play file-name.extension

eg: play Aqua_Barbie_Girl.mp3 will play only this file

 sox_play

8. To play next track Press Ctrl + c once and to stop or quit player, Press Ctrl and hit c twice.

9. For more about Sox , type man sox in the terminal and hit enter.