Find out how to Play Your Music Assortment from the Linux Command Line

Fatmavati Achmad Zaenuri/

Want a approach to play your assortment of MP3, OGG, and FLAC music recordsdata from the Linux command line? Here is easy methods to do it with a succesful, light-weight Terminal-based participant.

music on console

Even in lately of cloud-based streaming music platforms like Amazon Music and Spotify, likelihood is you will need to play one thing out of your native assortment of audio recordsdata once in a while. Possibly you will have one thing so obscure that streaming companies do not have it. Otherwise you ask for a selected monitor and so they maintain you enjoying stay variations, or prolonged remixes, or any variety of different variations, once you really need plain outdated first-release album tracks.

In fact, Linux is nicely served with music gamers. Rhythmbox, Clementine & Strawberry are absolutely featured, refined and polished functions for managing your music assortment. In addition to enjoying your music, they’re going to do issues like discover and obtain lacking album artwork, play podcasts and Web radio, and edit the meta-data within the recordsdata themselves.

However what if you wish to entry your music assortment from a terminal window, with out the overhead of a totally loaded music participant? Music on Console, or MOC, is a program that lets you do that. It hundreds within the blink of an eye fixed, enables you to search your music assortment, discover the one you need to play, and simply play it.

It helps a number of sound file codecs, playlists, and even primary themes. If you happen to’re a keyboard fanatic and maintain wandering round terminal home windows, then MOC is only a pure match for you. It’s absolutely keyboard managed. As soon as the keybindings burn themselves into your muscle reminiscence you’ll be able to management the MOC with out taking your hand off your keyboard.

When you will have an extended operating course of in a terminal window there’s at all times an opportunity that you just shut the terminal window accidentally. However even in the event you do, MOC has a neat trick for coping with it.

associated: What are the variations between MP3, FLAC and different audio codecs?

organising MOC

Putting in MoC on Ubuntu is easy:

sudo apt set up moc

ubuntu.  command to install mock on

Putting in MOC on Manjaro is as simple as:

sudo pacman -Sy moc

Manjaro.  command to install mock on

There are some extra steps to be taken to arrange MOC on Fedora.

First, we use wget To obtain the main points of RPM Fusion Repository. We have been utilizing Fedora 34. If you’re utilizing a unique model, corresponding to 35, substitute the model you might be utilizing for “34” within the command.


Downloading Repository Details on Fedora

Then we set up the main points of that repository.

rpm -Uvh rpmfusion-free-release-34.noarch.rpm

Installing Repository Details on Fedora

With that, we will go forward and arrange the MOC:

sudo dnf set up moc

Installing MOC on Fedora

moc config file

On Ubuntu and Manjaro, MoC began immediately. On Fedora, we needed to edit the MOC configuration file first. So as to add the placement of your music listing, it is a good suggestion to edit the MOC configuration file anyway. The configuration file is named “config” and is positioned within the “.moc” listing in your house listing.

Open a terminal window and be sure to are in your house listing. Open the configuration file in an editor. we used gedit,

gedit .moc/config

Discover and Edit, or add these two traces. Exchange “Dave” with your personal person account identify in these traces:

mocdir = /house/dave/.moc 
MusicDir = "/house/dave/Music"

On Fedora, we additionally had so as to add this line:

TiMidity_Config = /and so on/timidity.cfg

Editing the MOC Configuration File

TiMidity is a MIDI library utilized by MOC.

For safety causes, we have to be sure that the configuration file is writable solely by the proprietor. we’ll use chmod Command with a read-write/learn/learn masks of 644.

chmod 644 .moc/config

Setting access privileges on MOC configuration file with chmod

Now we’re prepared to start out the MOC.

First Steps with MOC

The command to start out MOC is mocp, Observe the added “p” which stands for “participant”.


Starting MOC with mocp command

The default view has a listing itemizing on the left and a playlist on the proper. When you’ve got configured your music listing in your “.moc/config” configuration file, MOC will open along with your music listing displayed within the left pane.

moc default layout

If you happen to navigate away out of your music listing, you’ll be able to shortly return to it by urgent the “M” key.

You’ll be able to transfer the spotlight bar with the “Up” and “Down” arrow keys and the “Residence”, “Finish”, “PGUP” and “PGDN” keys. Hitting “Enter” will choose the highlighted object.

  • If a listing is highlighted, you’ll enter that listing.
  • If the spotlight is on the “../” image, you’ll go up one listing within the listing tree.
  • If you happen to’re highlighting a music file, MOC will play that music file.

The “House bar” or “P” key pauses and pauses playback. The keybindings in MOC are case-sensitive, so be sure to use a lowercase “p”. The “S” key stops playback.

MOC playing a music track

“,” And “.” Urgent keys will increase or decreases the amount by 5%. for nice management,”<" और ">Alter the amount in steps of 1%. Urgent “Alt” with the quantity keys from 1 to 9 units the amount to 10%, 20% to 90%.

Closing MOC

The uppercase “Q” turns off the MOC and pauses playback. Urgent lowercase “Q” turns off the MOC. Buyer However that leaves the again finish.

This implies which you can shut the MOC consumer and terminal window and the MOC will proceed to play music within the background. opening a brand new terminal window and utilizing mocp The command begins a brand new consumer that mechanically connects to the background course of, permitting you to manage it.

use a playlist

Urgent “A” with the music file or listing highlighted provides them to the playlist. Conveniently, the spotlight is moved beneath the merchandise you simply added.

Urgent “d” with a playlist merchandise highlighted removes that merchandise from the playlist. After getting a couple of objects within the Playlists pane you’ll be able to transfer between the Listing and Playlist panes utilizing the “Tab” key.

Populating a playlist in MOC

Urgent the “L” key (lowercase “L” for “Format”) toggles between the default “twin pane” view and the one pane view.

In single pane view, the “Tab” key nonetheless switches between listing itemizing and playlist views, however with a “maximized” single pane.

MOC Single Pane View of Directory

helpful keybindings

Taking part in with MoC for ten minutes provides you with the whole lot it is advisable to know. You say “h” or “?” Urgent can get assist, however here is a fast record of crucial keys.

Closing MOC

  • Why: Shut down the consumer, go away the MOC operating within the background.
  • Why: Shut down the consumer and background course of.

enjoying music

  • enter: Play a monitor.
  • area both P: Pause playback.
  • n: Subsequent tune.
  • b: earlier monitor.
  • s: Pause playback.
  • ,: Lower the amount by 5%.
  • ,: Enhance the amount by 5%.
  • <: Lower the amount by 1%.
  • ,: Enhance the amount by 1%.

use a playlist

  • One: Add a monitor to a playlist. Works with directories too.
  • a: Add listing to playlist.
  • D: Delete an merchandise from the playlist.
  • C: Clear playlist.
  • you: Transfer a monitor up within the playlist.
  • Jay: Transfer a monitor down within the playlist.


  • tab: transfer between listing and playlist panes
  • I: Change between two-pane and single-pane layouts.
  • ,: Search listing and monitor identify.


The music on the console is refreshingly easy and satisfyingly succesful. It provides you all the fundamental capabilities of a music participant, which will be accessed from the keyboard.

That is music to the ears of a terminal jockey.

associated: Be a Linux Terminal Energy Person With These 8 Methods

Supply hyperlink