What are popular audio players for the command line?
- How to play a single sound file?
- Are there command line players that also index the music library like Banshee, Exaile, etc.?
15 Answers
I have compiled a complete list of commandline and other lightweight tools for linux: Best Lightweight Applications for Linux. It also has a list of other music players.
Here is my personal favorite: cmus.
13With MOC we have a powerful commandline player that is capable of browsing directories, generates playlist can can even be extended with plugins, e.g. for lastFM streams.
VLC has a command line interface:
cvlc -I ncurses ~/Music/MPlayer has also a command line interface, but I am not sure if it can play audio as well.
2Install vorbis-tools (sudo apt-get install vorbis-tools) to get ogg123:
$ ogg123 -v example.ogg
Audio Device: Advanced Linux Sound Architecture (ALSA) output
Author: Bill Currie <>/Kevin Cody, Jr. <>
Comments: Outputs to the Advanced Linux Sound Architecture version 0.9/1.x
Playing: example.ogg
Ogg Vorbis stream: 1 channel, 44100 Hz
Vorbis format: Version 0
Bitrate hints: upper=0 nominal=160000 lower=0 window=0
Encoded by: Xiph.Org libVorbis I 20101101 (Schaufenugget)
Encoded by: SONY IC RECORDER MP3 1.1.0
Album: ptiha
Date: 2012
Artist: Michael Laitman
Time: 00:42.17 [218:51.85] of 219:34.02 (142.0 kbps) Output Buffer 88.9%ogg123 reads Ogg Vorbis audio files and decodes them to the devices specified on the command line. By default, ogg123 writes to the standard sound device, but output can be sent to any number of devices. Files can be read from the file system, or URLs can be streamed via HTTP. If a directory is given, all of the files in it or its subdirectories will be played.
1mpg123 is a fast, free and console MPEG audio player software program for UNIX and Linux operating systems. mpg123 was ported to the Windows platform using Cygwin and MinGW. It supports MPEG-1 and -2, layers 1, 2 and 3. Its most common use is to play MP3 files. It also comes as a Winamp plugin.
mpd (daemon) + ncmpcpp (client/interface):
MPD is able to scan a directory and create a music library from its ID3 tags. Ncmpcpp has a library view which lets you add songs/albums/artists to the current playlist, search for tags and edit them in place.
1I like mplayer. It's very basic player, but sometimes I find it very useful (for example, I can specify it manually the audio driver I want it to use).
To play a file: mplayer file
As far as I know it cannot manage playlists.
1For single file, check aplay, play, and paplay (for Pulseaudio only).
namp - ncurses audio media player - is a minimalistic console-based audio player for Linux (and macOS). In addition to Winamp keybindings operation it also supports mouse control. The audio formats supported is determined by the underlying system, but generally mp3, wav, flac, etc should work fine.
How to play a single sound file:
namp ~/Music/Hello.mp3Full disclosure: I'm the author of namp. I used cmus, moc and mpd before finally settling on writing my own (very simple) audio player. It's currently not available via apt so you need to copy & paste some commands from the link above to build it from sources.
Just write one line in terminal;) and listen to radio streams
for OGG/OPUS streams
wget -qO- | opusdec - - | aplay -qfdat be sure you have installed opus packages
for listen OGG/Vorbis radio stream just write
ogg123 You need to have installed vorbis packages
Enjoy
mpg123 ()
it's in the universe repositories, supports playlists and streaming from web-sources. When startet with -C you can also skip tracks in playlist etc. edit: not sure about ogg support.
music123
A command-line shell for programs like mpg123 and ogg123, music123 plays a variety of sound files using a mpg123/ogg123-like interface. With all the Recommends installed, music123 plays wav, mp3 and ogg files. By simply changing the config file, music123 can play any sound file you have a player for.
(If you install a recent version of vorbis-tools, music123 will handle Ogg Flac and Ogg Speex files too.)
sudo apt install ffmpeg gives you an industry standard in playing music and videos from the command line. Two tools I use in my own GUI music player I'm starting to develop are called from the command line:
ffprobegives details on songsffplayplays a song
ffprobe
ffprobe version 2.8.17-0ubuntu0.1 Copyright (c) 2007-2020 the FFmpeg developers built with gcc 5.4.0 (Ubuntu 5.4.0-6ubuntu1~16.04.12) 20160609 configuration: --prefix=/usr --extra-version=0ubuntu0.1 --build-suffix=-ffmpeg --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --cc=cc --cxx=g++ --enable-gpl --enable-shared --disable-stripping --disable-decoder=libopenjpeg --disable-decoder=libschroedinger --enable-avresample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libmodplug --enable-libmp3lame --enable-libopenjpeg --enable-libopus --enable-libpulse --enable-librtmp --enable-libschroedinger --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxvid --enable-libzvbi --enable-openal --enable-opengl --enable-x11grab --enable-libdc1394 --enable-libiec61883 --enable-libzmq --enable-frei0r --enable-libx264 --enable-libopencv libavutil 54. 31.100 / 54. 31.100 libavcodec 56. 60.100 / 56. 60.100 libavformat 56. 40.101 / 56. 40.101 libavdevice 56. 4.100 / 56. 4.100 libavfilter 5. 40.101 / 5. 40.101 libavresample 2. 1. 0 / 2. 1. 0 libswscale 3. 1.101 / 3. 1.101 libswresample 1. 2.101 / 1. 2.101 libpostproc 53. 3.100 / 53. 3.100
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x1f88060] stream 0, timescale not set
[mjpeg @ 0x1f8aa80] Changeing bps to 8
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '15 Mr. Roboto.m4a': Metadata: major_brand : M4A minor_version : 0 compatible_brands: M4A mp42isom creation_time : 2012-05-16 16:41:23 Encoding Params : vers iTunNORM : 00000CD2 00000BFE 000072CF 00006BB6 0004C2DD 0004C2DD 00007FEE 00007F9B 000139A6 0001A6C4 iTunSMPB : 00000000 00000840 00000248 0000000000DE9978 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 iTunes_CDDB_IDs : 16++ compilation : 0 disc : 1/1 gapless_playback: 0 track : 15/16 artist : Styx album : Greatest Hits date : 1983 genre : Rock title : Mr. Roboto encoder : iTunes 10.6.1.7 composer : Dennis DeYoung Duration: 00:05:30.86, start: 0.000000, bitrate: 280 kb/s Stream #0:0(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 276 kb/s (default) Metadata: creation_time : 2012-05-16 16:41:23 Stream #0:1: Video: mjpeg, yuvj420p(pc, bt470bg/unknown/unknown), 316x316 [SAR 144:144 DAR 1:1], 90k tbr, 90k tbn, 90k tbcffplay
$ ffplay "15 Mr. Roboto.m4a"
ffplay version 2.8.17-0ubuntu0.1 Copyright (c) 2003-2020 the FFmpeg developers built with gcc 5.4.0 (Ubuntu 5.4.0-6ubuntu1~16.04.12) 20160609 configuration: --prefix=/usr --extra-version=0ubuntu0.1 --build-suffix=-ffmpeg --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --cc=cc --cxx=g++ --enable-gpl --enable-shared --disable-stripping --disable-decoder=libopenjpeg --disable-decoder=libschroedinger --enable-avresample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libmodplug --enable-libmp3lame --enable-libopenjpeg --enable-libopus --enable-libpulse --enable-librtmp --enable-libschroedinger --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxvid --enable-libzvbi --enable-openal --enable-opengl --enable-x11grab --enable-libdc1394 --enable-libiec61883 --enable-libzmq --enable-frei0r --enable-libx264 --enable-libopencv libavutil 54. 31.100 / 54. 31.100 libavcodec 56. 60.100 / 56. 60.100 libavformat 56. 40.101 / 56. 40.101 libavdevice 56. 4.100 / 56. 4.100 libavfilter 5. 40.101 / 5. 40.101 libavresample 2. 1. 0 / 2. 1. 0 libswscale 3. 1.101 / 3. 1.101 libswresample 1. 2.101 / 1. 2.101 libpostproc 53. 3.100 / 53. 3.100
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x7f796c0092a0] stream 0, timescale not set
[mjpeg @ 0x7f796c00b680] Changeing bps to 8
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '15 Mr. Roboto.m4a': Metadata: major_brand : M4A minor_version : 0 compatible_brands: M4A mp42isom creation_time : 2012-05-16 16:41:23 Encoding Params : vers iTunNORM : 00000CD2 00000BFE 000072CF 00006BB6 0004C2DD 0004C2DD 00007FEE 00007F9B 000139A6 0001A6C4 iTunSMPB : 00000000 00000840 00000248 0000000000DE9978 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 iTunes_CDDB_IDs : 16++ compilation : 0 disc : 1/1 gapless_playback: 0 track : 15/16 artist : Styx album : Greatest Hits date : 1983 genre : Rock title : Mr. Roboto encoder : iTunes 10.6.1.7 composer : Dennis DeYoung Duration: 00:05:30.86, start: 0.000000, bitrate: 280 kb/s Stream #0:0(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 276 kb/s (default) Metadata: creation_time : 2012-05-16 16:41:23 Stream #0:1: Video: mjpeg, yuvj420p(pc, bt470bg/unknown/unknown), 316x316 [SAR 144:144 DAR 1:1], 90k tbr, 90k tbn, 90k tbc
[swscaler @ 0x7f7958033ae0] deprecated pixel format used, make sure you did set range correctlyffplay in action
A progress counter is displayed whilst ffplay is operating and a GUI pop-up window is displayed with the song art (if X11 is not available to command line, such as console, or over ssh, then the GUI can be suppressed by adding the '-nodisp' flag:
Incorporate ffprobe and ffplay into your own GUI
I took these tools and am starting to develop my own GUI music player:
cmus
Plugins Input: Ogg Vorbis, MP3, FLAC, Musepack, WavPack, WAV, AAC, MP4, and everything supported by ffmpeg (WMA, APE, MKA, TTA, SHN, ...) and libmodplug Output: PulseAudio, ALSA, OSS, RoarAudio, libao, aRts, Sun, and WaveOut (Windows)
I've used mp3blaster in the past. It supports Playlists, Groups, Repeat, Search. Not many special features.
2Following on from the excellent shell pipeline answer given by @artem here's an mp3 version that I've just worked out:
URL=
wget -qO- $URL | lame --quiet --decode --mp3input - - | pacat(if you're not using pulseaudio, just swap the pacat for aplay)