3 command-line music players for Linux

7 readers like this.
music infinity

Opensource.com

One perception that Linux can't seem to shake off is that you can't do anything without using the command line. A number of people in my circle have been using Linux effectively for years, and they've yet to crack open a terminal window.

Having said that, working at the command line can make certain tasks faster and more efficient. If you're using older hardware, command-line tools are an excellent alternative to graphical applications since they don't use too many resources.

One of those tasks playing music. You can do that in a terminal. How? Here's a look at three command-line music players.

cmus

cmus is a fast and flexible music player. It organizes your music by either musician or album title, and lets you load playlist files. You can also use cmus' built-in search function to look for music in your /home directory and you can switch between several different layouts.

If you're a fan of the vi editor, you'll be right at home in cmus. It uses keyboard shortcuts inspired by vi (for example, :add ~/music to load a folder) and you manuever through tracks by pressing the j and k keys.

climus_cmus.png

MOC

MOC (short for Music on Console) is a dual-pane music player that's similar to cmus. The left pane lists the tracks in a folder, while the right pane contains the contents of a playlist file (if there is one in the folder).

Working with your music is simple. MOC's keyboard shortcuts are quite intuitive. How intuitive? You press n to play the next track in your list or p to play the previous one, and press S to set MOC to shuffle tracks.

climus_moc.png

mpg123 and ogg123

If you want a quick and dirty way to play music files, then mpg123 and ogg123 are good options. I've lumped them together because both applications are very similar. In fact, the only difference between the two applications is the file formats they support.

mpg123 has no frills. Just go to the folder containing the MP3 files that you want to play and type mpg123 *.mp3. You can also load a playlist file and use the *-z* option on the command line to shuffle the tracks you want to play.

climus_mpg123.png

If you're adamant about using truly open formats, then you'll want to go with Ogg Vorbis for your music. That's where ogg123 comes in. ogg123 is part of a suite of applications called vorbis-tools, which comes pre-installed with a number of Linux distributions.

ogg123 works in exactly the same way, and uses the same options, as mpg123. Just substitute .ogg or .oga for .mp3 when specifying the files you want to play.

climus_ogg123.png

(Note: An upcoming article will look at command-line tools for converting between audio formats.)

Bonus tool: ripit

ripit isn't a music player, but it can help you feed your music player. It's a script that works with a number of utilities and audio encoders—like cdparanoia, cdda2wav, Ogg Vobis, and LAME—to convert the tracks on a CD to files on your hard drive.

You can rip your CDs to several formats including MP3, Ogg, MP4, and FLAC. The script walks you through the ripping process, and will even grab information about the CD from CDDB or MusicBrainz (two online repositories of music metadata). If ripit can't find the CD's metadata online, it lets you enter that information yourself. You can also tell ripit which tracks on a CD that you want, rather than ripping all of the songs on the disc.

climus_ripit.png

Do you have a favorite command-line music player? If you do, feel free to share it by leaving a comment.

That idiot Scott Nesbitt ...
I'm a long-time user of free/open source software, and write various things for both fun and profit. I don't take myself all that seriously and I do all of my own stunts.

8 Comments

xmms2 and jack will do the trick just as well

mplayer works pretty well too.

I just came across 'aplayer' on Debian and it worked as advertised. Not elegant at all.

You don't have to use the command line for everything in Linux. For me, it's just more fun and educational. Love MOC.

I use mpd+ncmpcpp for my music, and mpv for video from the command line.
I've even gone so far as to dedicate an old x86 tablet to run ncmpcpp to control mpd on the media center computer from my desk.

If you need to play obscure music formats, you can pull out the jack of all trades of media players, vlc. It has a huge number of command line options. There is also the command line-oriented variation, cvlc, which plays media without bringing up the GUI.

The simplest case:

cvlc

will play a file, just as mpg123 does... except that it will play just about any imaginable audio format.

Creative Commons LicenseThis work is licensed under a Creative Commons Attribution-Share Alike 4.0 International License.