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 S 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.
(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.
Do you have a favorite command-line music player? If you do, feel free to share it by leaving a comment.