Play music from command line

By | May 21, 2011

Although there are a lot of GUI media players out there, it is also possible to listen to your favorite music from the command line.  The mpg123 tool allows you to play a song, a playlist or even a stream and has all major features of a GUI media player: control keys, equalizer, replay gain, gapless playback.

Some well known supported audio interfaces are ALSA (Advanced Linux Sound Architecture), JACK (Jack Audio Connection Kit), OSS (Open Sound System), PulseAudio (sound server for POSIX and Win32), Win32 (Windows WaveOut).

The decoder part of mpg123 may be used as a library in other applications.

Usage examples:

Use the “-v” option to increase verbosity level and display detailed info. Also use quotes for files with spaces in their names.

Play audio file from local storage:

mpg123 -v "Music/Ugly Kid Joe - Cats in the Cradle.mp3"

Play stream, just like local files; provided stream is “borrowed” from SoundCloud, thus might not be available anymore:

mpg123 -v

Play a remote or local playlist using the “[email protected]” parameter, to read filenames from playlist:

mpg123 -v [email protected]

2 thoughts on “Play music from command line

  1. sebastian

    There is a lot of articles and blog-posts about mpg123, but anyone has a step by step explanation for dumies. The man page is not very helpful either. I’m looking for a tutorial. I know I’ve to use wget, grep take the address http://123.456… , but I need a tutorial and I find a lot of people like me in forums asking how to use it.

  2. cristian.radulescu Post author

    @sebastian I’m not sure what exactly you want to know about mpg123, but I have updated the article with some usage examples. Also, why use wget when mpg123 supports streaming?

Leave a Reply