Linux music on console

From Ever changing code
Jump to navigation Jump to search

MOC - Music On Console

One of favourite music player in terminal is MOC - Music On Console feature rich, easy to use and solid stable. So, follow the steps below for a of minimum configuration and quick way to start listening your most favourite notes.


apt-get install moc moc-ffmpeg-plugin


mocp                #start MOC
  • T - theme selection
  • o - open URL
  • ^u - add URL to a play-list
  • A - add a folder recursively to play-list
  • d - remove track from play-list
  • V - save play-list current location at a given file name, can override
  • C - clear play-list
  • < or > - master volume down or up
  • q - quit MOC
  • Q - shutdown the mocp service
  • Shift+C - clear play-list
  • Shift+A - append tracks from selected (from left) to the current play-list (to right pane)

Custom shortcuts configuration

The package includes a sample configuration file at /usr/share/doc/moc/config.example. To configure moc, copy this file to ~/.moc/config and edit it. For instructions about customizing the keybindings, read /usr/share/doc/moc/keymap.example.

 cd ~/.moc && cp /usr/share/doc/moc/examples/config.example.gz ./ && gunzip config.example.gz && mv config.example config

Edit playlist manually radio stream

Go to or similar Internet radio portal and download a playlist file .pls. Open using a text editor and find any stream links and add them to MOC playlist pressing ^u in mocp.

My example of linux-radio-mocp.m3u playlist file:

#EXTINF:-1,>>> P O L S K A S T A C J A <<<- Chillout
#EXTINF:-1,Tylko Polskie Przeboje
#EXTINF:-1,Tylko Polskie Przeboje
#EXTINF:-1,Tylko Polskie Przeboje - HQ
#EXTINF:-1,Tylko Polskie Przeboje
#EXTINF:-1,Radio Zet

Note that each stream entry has 2 lines, first is title position and the title itself in green, the second line is direct url to the stream.

Automatic download and import of playlists

Download python script and add executable attributes. As recently DigitallyImported is paid service you may not be able to download all playlists but I was able to download followings, please make sure you are running this from not UK ip address:

cd ~ && mkdir -p Playlists && cd Playlists        #Create and navigate to Playlist directory
 python -s di -q 40           #Low quality DI lists
 python -s sky -c mp3         #Sky radio mp3 lists
 for file in *.pls; do mocp -a $file; done         #Import all .pls lists to mocp

Now just run mocp and you should see all lists in the right pane.

Audio Mixer on console

ALSA sound control system is one of most popular way to manipulate your sound card settings. It runs in a console.


sudo apt-get install alsa alsa-tools           # installs alsa-base, alsa-utils, alsa-tools and libasound2
sudo adduser yourusername audio                # add yourself to the group audio
sudo init 6                                    # reboot to take effect 


alsamixer          # start

Use arrows up and down to change volume, left and right to change source. To mute/unmute press M. To quit press Q.