Note: you are currently viewing my old website. My new website is here.

Howto set-up MOC (music on console)

MOC (music on console) is a console audio player for Linux/Unix designed to be powerful and easy to use. This guide details how to install and set-up MOC under Debian “Squeeze”/CrunchBang “Statler”. It also details how to scrobble tracks to


MOC is available from the Debian repositories, it can be installed with the following command:

sudo apt-get update && sudo apt-get install moc moc-ffmpeg-plugin

Once installed, MOC can be run using the command:


The MOC binary is named ‘mocp’ to avoid a naming conflict with existing software.

Basic usage

Once MOC is running, the following keys can be used to control it:

           tab: toggle between directory list and playlist
             a: add selected track to playlist
             C: clear the playlist
         enter: play or move between directories
up/down arrows: navigation
             p: pause
             s: stop
             q: quit and keep running
             Q: quit for real
             .: volume up increments of 5
             ,: volume down increments of 5
             >: volume up increment of 1
             <: volume down increment of 1
             T: toggle to themes list, browse, and try them out

config file

Below is a config file for MOC, with sensible defaults. Copy the code below to the file ~/.moc/config.

Notes: If you have not previously run MOC, you will need to create the file. Also, the config refers to ‘monochrome_theme’, which is detailed further down the page. It also refers to the lastfmsubmit program, which is also detailed further down the page.

ReadTags              = yes
MusicDir              = "~/music"
Sort                  = FileName
ShowStreamErrors      = no
Mp3IgnoreCRCErrors    = yes
Repeat                = no
Shuffle               = no
AutoNext              = yes
FormatString          = "%(n:%n :)%(t:%t:)"
OutputBuffer          = 2048
InputBuffer           = 512
Prebuffering          = 64
SoundDriver           = JACK, ALSA, OSS
JackOutLeft           = "alsa_pcm:playback_1"
JackOutRight          = "alsa_pcm:playback_2"
OSSDevice             = /dev/dsp
OSSMixerDevice        = /dev/mixer
OSSMixerChannel       = pcm
OSSMixerChannel2      = master
AlsaMixer             = PCM
AlsaMixer2            = Master
AlsaDevice            = default
ShowHiddenFiles       = no
StartInMusicDir       = yes
HideFileExtension     = no
ShowFormat            = yes
ShowTime              = yes
Theme                 = monochrome_theme
MOCDir                = ~/.moc
UseMmap               = no
SyncPlaylist          = yes
ASCIILines            = no
Fastdir1              = ~/music
TagsCacheSize         = 256
PlaylistNumbering     = yes
Layout1               = "directory:0,0,50%,100% playlist:50%,0,50%,100% "
FollowPlayedFile      = yes
CanStartInPlaylist    = no
OnSongChange          = "/usr/lib/lastfmsubmitd/lastfmsubmit --artist %a --title %t --length %d --album %r"

Theme file

Below is a nice monochrome theme file for MOC. Copy the code below to ~/.moc/themes/monochrome_theme. Credit for the theme goes to pvsage on the CrunchBang Forums.

background             = default    default
frame                  = default    default
window_title           = default    default
directory              = default    default    
selected_directory     = default    default    reverse
playlist               = default    default
selected_playlist      = default    default    reverse
file                   = default    default
selected_file          = default    default    reverse
marked_file            = default    default    bold
marked_selected_file   = default    default    bold
info                   = default    default
selected_info          = default    default
marked_info            = default    default    
marked_selected_info   = default    default    
status                 = default    default
title                  = default    default    
state                  = default    default   
current_time           = default    default
time_left              = default    default    
total_time             = default    default   
time_total_frames      = default    default
sound_parameters       = default    default
legend                 = default    default
disabled               = default    default
enabled                = default    default    bold
empty_mixer_bar        = default    default
filled_mixer_bar       = default    default    reverse
empty_time_bar         = default    default
filled_time_bar        = default    default    reverse
entry                  = default    default
entry_title            = default    default
error                  = default    default    bold
message                = default    default    bold
plist_time             = default    default

Scrobbling to

lastfmsubmitd is a submission daemon for the social music network. It can be configured to work with as detailed. lastfmsubmitd is available from the Debian repositories and can be installed with the following command:

sudo apt-get update && sudo apt-get install lastfmsubmitd

During the installation you will be prompted for your username and password, you will also be prompted to enter a group name, leave the group name as ‘lastfm’. Once the installation is complete, add yourself to the ‘lastfm’ group with the following command:

sudo usermod -a -G lastfm $USER

Next, open the lastfmsubmitd configuration file:

sudo nano /etc/lastfmsubmitd.conf

Add the following lines, save and exit:

url =

Next, restart lastfmsubmitd:

sudo /etc/init.d/lastfmsubmitd restart

Finally, you will need to log out of the user account and log back. Once you have done this, any tracks played in MOC should be scrobbled to

Tagged with: librefm, linux, moc, music

3 responses to “Howto set-up MOC — music on console”

Add your comment

Use the form below to add your comment. Markdown syntax is available. Note, all comments are moderated.