How To Play Music From Command Line (Terminal)

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


2. Input your password and  hit enter.


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


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


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


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

eg: play Aqua_Barbie_Girl.mp3 will play only this file


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.

  • misty

    a better way is to use the vlc ncurses interface… vlc -I ncurses *.mp3 in a folder. This comes with a new ncurses interface to browse and manage playlist too!! :)

  • Enock Seth

    I agree with you. But this will be simpler for newbies. :)

  • luke7

    MOC – Music on console:

    Supported file formats are: mp3, Ogg Vorbis, FLAC, Musepack (mpc), Speex, WAVE,
    supported by FFmpeg (WMA, RealAudio, AAC, MP4), AIFF, AU, SVX, Sphere Nist WAV,
    IRCAM SF, Creative VOC.

    moc is available in default repositories:
    sudo apt-get install moc

    to open, type “mocp”

  • Matt Whitlow

    cmus –

    full music player with library and playlists and such.


    pianobar –

    is a pandora streamer through the terminal.

  • Padhu

    It is better to use ‘ncmpcpp’. Because it is feature rich . :-)

  • madingmo

    Yes i prefer to use MOC, it is feature rich.