This post was first published, in a slightly different form, at Opensource.com and appears here via a CC BY-SA 4.0 license.
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 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.
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 R to set MOC to shuffle tracks.
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.
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.