Want to play local music from terminal or command console in Linux? It’s quite easy to do the job via MOC!
MOC (Music On Console) is a lightweight music player similar to MPD. It provides a simple and easy to use command line interface with folder tree in left, playlist in right, and current playback in bottom.
Simply use up/down arrow keys to browse files in left, hit Enter to start playing all music in current folder. Or press ‘a’ to add to playlist, use ‘Tab’ key to switch focus between left and right.
Supported file formats including MP3, Ogg Vorbis, FLAC, Musepack (mpc), Speex, Opus, WAVE, AIFF, AU, SVX, Sphere Nist WAV, IRCAM SF, Creative VOC, SID, wavpack, MIDI and modplug. It as well can play WMA, RealAudio, AAC, and MP4 by using FFmpeg/LibAV plugin.
How to Install and use Music On Console (MOC)
Moc is available in most Linux system repositories. Simply open a terminal window and run one of the commands below to install it:
- For Debian, Ubuntu, Linux Mint, etc, run command to install moc:
sudo apt install moc
- For Arch and Manjaro Linux, use command below to install it:
sudo pacman -S moc
- And, Fedora user can run command to install it after enabling RPM Fusion repository:
sudo dnf install moc
After installation, run mocp
command to start the player in command console. Then start browsing and playing your music files. It also has many command line options for advanced users, run mocp –help to see how to use it.
And, here’s a table of keyboard shortcuts to control the music player:
Start playing at this file or go to this directory | Enter |
Pause | Space or p |
Play next file | n |
Play previous file | b |
Silent seek forward by 5s | ] |
Silent seek backward by 5s | [ |
Switch between playlist and file list | Tab |
Add a file/directory to the playlist | a |
Add a directory recursively to the playlist | Shift+a |
Delete an item from the playlist | d |
Clear the playlist | Shift+c |
Increase volume by 1% | > |
Decrease volume by 1% | < |
Increase volume by 5% | . (period) |
Decrease volume by 5% | , (comma) |
Set volume to 10% | Alt+1 |
Set volume to 90% | Alt+9 |
Detach MOC from the server | q |
Quit | Shift+q |
Moc can run in background even after your closed the terminal/command console. To stop it, run the mocp -x
command at any time in terminal.
MOC also support themes! ArchWiki is a good place to see more about it.
Use panel indicator to control MOC Playback in Ubuntu
Moc does not support for remote control, but user can use an indicator applet on panel to start, stop and control the playback it.
For Ubuntu/Linux Mint based systems, there’s an exo-player can do the job.
1. First, press Ctrl+Alt+T on keyboard to open terminal (Koncole). Then, run command to add the official PPA:
sudo add-apt-repository ppa:blaze/main
Type user password (no visual feedback) when it asks and hit Enter to continue. The PPA so far provides the latest version for Ubuntu 20.04, Ubuntu 22.04, Ubuntu 22.10, though there’s also old package for old Ubuntu releases.
2. Then, run command to install the exo-player package:
sudo apt install exo-player
Linux Mint may need to run sudo apt update
first to fresh package cache.
3. Finally, search for and open the indicator either from start menu or ‘Activities’ overview depends on your desktop environment.
Then you should see the applet in the system tray area. Click ‘Player‘ to launch moc player if it didn’t start, use ‘Add‘ to add songs, and enjoy music with the control buttons.
NOTE: Music playback won’t stop even after quit the indicator, without clicking ‘Stop’ button.
Recent Comments