A person using a desktop computer wearing headphones

How to Play Music From the Linux Terminal With cmus

When you want to listen to some music, you’ll most likely turn to the GUI audio file or streaming player that came with your distro, but what if you could play music from the command line? It’s easy with Linux and a little program called cmus.

What Is cmus?

cmus, or C* Music Player, is a text-based audio player for Linux and other Unix-like systems. In a sea of GUI music programs, cmus is unique in its focus on the console.

cmus’ text orientation makes it a natural fit for older computers or ones without X or Wayland installed at all. You could set up an older computer for use as your jukebox.

It supports several major audio file formats, including MP3, Ogg Vorbis, FLAC, WAV, MP4, and many more via plug-ins. You can even play regular old audio CDs if you haven’t sold them off and replaced them with vinyl, you hipster. And that’s another major feature of cmus: its library of plug-ins.

YouTuber Retrochad has even used an old text terminal to control a server running cmus to play music:

This shows cmus’ flexibility in the face of flashier music playing programs.

The program uses keybindings similar to Vim, so if you’re familiar with that editor, you should find navigating around cmus easy.

Installing cmus on Linux

Installing cmus is simple on most Linux systems using the default package manager.


For example, on Debian/Ubuntu:

sudo apt install cmus

And on Arch Linux:

sudo pacman -S cmus

To install cmus on RHEL, Fedora, or Rocky Linux:

sudo dnf install cmus

Adding Music to cmus

Now that you’ve installed cmus, you’ll have to point it to wherever your music files are stored on the hard drive.

To launch cmus, simply type “cmus” at the shell.

As mentioned before, cmus uses a Vim-like control scheme. To enter commands, you just hit the Colon (:) key and enter commands on the command line. You don’t even have to hit Esc first.

To add your music, you use the “a” command followed by the path to your music library. For example, if you keep your music files in a directory called music on your home directory, you’d issue this command:

:a ~/music

You’ll now see your music library.

Playing Music With cmus on Linux

Now that you’ve imported your music, you can start playing it. To select artists and albums, use the Vim standard motion keys: K for up and J for down, to move in the menu screen. Press the Tab key to toggle between artist/album and track selections.

To start playing a track, press Enter or “x.” Press “c” to pause it. To seek forward, press “l” and “h” to seek back. To skip to the next track, press “b.” To skip back, press “z.” Remember that cmus, like Vim, is case-sensitive, so these are the lower-case letters. Upper-case letters will perform different commands.

One disadvantage of cmus is that as with most text-based programs, you have to memorize the commands to do anything, but once you get the hang of it, the finger habits and muscle memory will be automatic to you. Again, this is similar to Vim.

Additional cmus Plugins

There are a number of plugins available for cmus. Many of them are listed on the cmus wiki. They’re written in standard scripting languages like Bash or Python.

To use these scripts, usually all you have to do is download them and make them executable with the chmod command. For example:

chmod a+x script

You can do everything from “scrobbling” to Last.fm to show the world what you’re listening to, to downloading tracks from Spotify. You can also apply custom themes and even display album artwork inside the terminal.

cmus is a very versatile piece of software. It’s this kind of flexibility that endures text-based programs to many sophisticated Linux users.

Who Needs a GUI to Listen to Music?

While the Linux command line is productive, you can also use programs like cmus to relax and put some music in your busy day of Linux computing. You can tailor cmus to your needs with all the various plugins available. If you’re looking for more tools to make enjoying music even better on your Linux system, read on.

Original Link

Leave a Comment

Your email address will not be published.

Scroll to Top