Debian/Ubuntu
The static side of TuxArena
CMus is a free, powerful, terminal-based music player using the ncurses toolkit. CMus supports various audio formats, including Ogg Vorbis, FLAC, MP3, WAV, Musepack, WavPack, WMA, AAC and MP4. Although CMus is not the only good player for the shell (alternatives like MOC, Herrie or mp3blaster are also available), I prefer it due to its unique keyboard shortcuts and feature completeness. This guide is divided into the following sections (click on any to jump directly to it):

CMus Features
Using CMus
Enabling Last.fm or Libre.fm Song Submission in CMus
How-To: Compile and Install CMus in Debian 5.0 Lenny
CMus Features
Here are the main features of CMus:
  • Gapless playback
  • ReplayGain support
  • MP3 and Ogg streaming from SHOUTcast or Icecast
  • Playlist support and powerful playlist filters
  • Play queue
  • File browser
  • Last.fm or Libre.fm song submission support (via scripts)
  • Seven different view modes
  • Color themes
  • Vi-like keyboard shortcuts
Using CMus
First of all, we will add several songs to the media library. CMus uses Vi-style commands, so all the commands will start with : followed by a certain command. For example, to add all the audio files inside the ~/music directory, we would use:
:add ~/music
To quit CMus at any time, use the :q command (or press Q followed by Y).

CMus offers seven different views, which can be accessed using the 1-7 keys. Here they are:
  • 1 - Library, the default view mode, including two tabs (artists/albums and songs in currently selected album)
  • 2 - Sorted Library, which provides a playlist view allowing to jump to specific tracks (this view can be customized in view mode 6
  • 3 - Playlist, editable playlist
  • 4 - Play Queue, which displays the track queue
  • 5 - File Browser
  • 6 - Filters, a list of user-defined filters for the library
  • 7 - Settings, which displays key bindings and commands
Library view mode

The two views which you will usually use are the first and the second one. Let's have a look at the first one:

cmus_mode_1.png

The left tab contains the artists and their albums. To navigate through those use the Up/Down arrow keys or J and K, and press Space to expand the tree view. Whenever you select an album the tracks will appear in the tab to the right side, so you can use the TAB key to switch between the two tabs and Enter to start playing the currently selected song. Here are several useful keyboard shortcuts:

TAB to switch between the two tabs
X to start playing
V to stop playing
C to pause playing
- to decrease volume by 10%
+ to increase volume by 10%

Sorted Library view mode

The second view mode (Sorted Library) allows you to quickly jump to a song by using the / (slash character), and then type words from the song you want in any order. Press Enter twice to play the song or N to search for the next occurence.

cmus_mode_2.png

CMus commands and keyboard shortcuts

Using Vi-style keyboard shortcuts, CMus allows you to use commands which are prepended by : and it supports auto-completion using TAB. Here are several useful commands (a complete list is available in view mode 7 or in the manual page):
  • :set softvol=true - enable software volume control
  • :add /path/to/music/dir - will add all the audio files from /path/to/music/dir to the library
  • :clear - will clear the playlist
  • :save playlist.pls - will save the current playlist
  • :load playlist.pls - will load playlist.pls
  • :set status-display-program=/path/to/scrobbler - will set the script to use for Last.fm song submission
Using themes (color schemes)

CMus supports several color schemes using the :colorscheme command. For example, :colorscheme xterm-white looks like this:

cmus_colorscheme
Enabling Last.fm and Libre.fm Song Submission
Although CMus doesn't comes with an integrated Last.fm song submission feature by default, the official website provides several scripts which can do it, and activating any one of them is quite easy. For our example we will use the Perl script, which is available here under the name post-fm. First copy the script from this address, preferably inside your ~/.cmus directory, and then edit it with a text editor to fill in your Last.fm username and password. Replace your-login and your-password with their appropriate values:
our %rc = (
login => "your-login",
password => "your-password",
Next, make the script executable, e.g.:
chmod 755 ~/.cmus/post-fm
Now let's enable the script. The newest version of CMus comes with the :set status-display-program command which allows you to set which script you want to use for scrobbling tracks. So to enable it, use the following command:
:set status-display-program=~/.cmus/post-fm
Your track submission should be enabled now. Notice that for Libre.fm you can uncomment the line which reads # host => 'turtle.libre.fm',, just under where you filled in the username and password fields.
How-To: Compile and Install CMus in Debian 5.0 Lenny
First, fetch the needed dependencies:
apt-get build-dep cmus
Download the source tarball from the official website (direct link here) and uncompress it:
tar -xjf cmus-v2.3.3.tar.bz2
To compile and install issue:
./configure
make
make install
The last one as root. Alternately you can specify a different installation prefix and install as normal user, e.g.:
./configure --prefix=/home/USER/usr
make
make install
In which case you should make sure /home/USER/usr/bin is in your $PATH.