Code Self Study Forum

How to play music in the terminal with MPlayer

Here’s a quick guide on how to play music in the terminal with MPlayer.

Install MPlayer

Something like this should work on Debian-based GNU/Linux distros:

$ sudo apt update
$ sudo apt install mplayer

I’m not sure how to install it on other operating systems (brew on Mac?), but the website has a downloads page.

Play Music

cd into the ~/Music directory (or wherever you keep your music) and type something like:

$ mplayer some_directory/*

or the partial name of an artist with wildcards, like this for Soft Machine:

$ mplayer *Soft*


A playlist is just a text file with a list of music files to play. List your media files in a .txt file and then run it like this:

$ mplayer -playlist some_playlist.txt


and move back and forward in a track.

< and > go to the previous and next tracks.

For more documentation, type this:

$ man mplayer

Other Terminal-Based Media Players

There are some other command line players with more features, but I’ve settled on mplayer at the moment, because it’s simple.