We, the Terminal-savvy people, do not like to leave the comfort of the command line and go somewhere else to do our activities. We always find ways to do all our stuff right inside the Terminal. Why should listening to music be any different? Using the Terminal makes certain tasks more efficient and even faster. The command-line tools do not use too many resources and thus form great alternatives to the widely used graphical applications, especially if you are stuck up with older hardware.

In this article, we will describe three tools through which you can listen to your favorite music right from your Linux Terminal. We will explain how you can install each of these tools, use them, and remove them from your system if need be.

We have run the commands and procedures mentioned in this article on a Ubuntu 18.04 LTS system.

Method 1: Using MOC

MOC or Music on Console is a command-line music player for Linux and Unix like systems. All you have to do is install the player, select a file from a directory using the MOC menu and all files in that directory start playing, starting from the selected file. MOC is an easy to use yet powerful tool. It supports a number of audio formats such as OGG Vorbis, Mp3s, Speex, Wave, wavpack, SID, AAC, MIDI, and many others.

The mplayer utility is easily available through the official Ubuntu repositories and can easily be installed through the command line using the apt-get command.

Open your Ubuntu Terminal either through the Application Launcher search or by using the Ctrl+Alt+T shortcut. Enter the following command in order to refresh the list of available packages:

$ sudo apt-get update

Update package lists

Then , run the following command to install MOC and MOC FFMPEG plugin that helps in recognizing many other audio formats.

$ sudo apt-get install moc moc-ffmpeg-plugin

Installing MOC Media Player

The system might ask you the password for sudo and also provide you with a Y/n option to continue the installation. Enter Y and then hit enter; the software will be installed on your system. The process may, however, take some time depending on your Internet speed.

If you ever want to remove MOC installed through this method, you can use the following command in the Terminal:

$ sudo apt-get remove moc moc-ffmpeg-plugin

Play music through MOC

Use the following command to launch MOC:

$ mocp

You can then use the following shortcuts to enjoy music as you like:

  • P-for playing music
  • B-for playing previous track
  • N- for playing next track
  • Q-for hiding the MOC interface
  • H-for help on using the player

Method 2: Using CMUS

The CMUS player is a free and open-source terminal-based audio player for Linux. It is a fast, powerful and lightweight player based on ncursed. It is distributed under GPL(GNU public license) and is meant to run only on a Terminal based UI. It uses the text-only interface so that very few resources are used, especially when using older computers. You can also utilize it on systems where the X window system doesn’t work.

The CMUS utility is easily available through the official Ubuntu repositories and can easily be installed through the command line using the apt-get command. You can do so by running the following command as sudo:

$ sudo apt-get install cmus

Install cmus Media Player

The system might ask you the password for sudo and also provide you with a Y/n option to continue the installation. Enter Y and then hit enter; the software will be installed on your system. The process may, however, take some time depending on your Internet speed.

If you ever want to remove CMUS installed through this method, you can use the following command in the Terminal:

$ sudo apt-get remove cmus

For the latest version of the application, you can also use the JMUC PPA repository to install CMUS. Use the following command to do so.

$ sudo add-apt-repository ppa:jmuc/cmus
$ sudo apt-get update

And then,

$ sudo apt-get install cmus

Play music through CMUS

Use the following command to start the CMUS interface:

$ cmus

Then enter 5 to browse to the music you want to play. Use the arrow keys to select a file and press a. This will take you to the next line and you can add multiple files and folders to your library. After adding your desired files, press ‘:’. A command prompt appears where you can enter ‘save’ and then Enter to save the library.

Play music with cmus Media Player

Method 3: Using mpg123

mpg123 is a free and open-source audio player. It supports MPEG audio formats, including MP3. It is a console application, meaning that it has no graphical user interface. Is would help us in the sense that we can play music from the command line through it.

The mpg123 utility is easily available through the official Ubuntu repositories and can easily be installed through the command line using the apt-get command. You can do so by running the following command as sudo:

$ sudo apt-get install mpg123

Install mpg123

The system might ask you the password for sudo and also provide you with a Y/n option to continue the installation. Enter Y and then hit enter; the software will be installed on your system. The process may, however, take some time depending on your Internet speed.

If you ever want to remove mpg123 installed through this method, you can use the following command in the Terminal:

$ sudo apt-get remove mpg123

So, these were three tools for you to enjoy music right from within your Terminal application.

Listen to Music through the Ubuntu Terminal