Play Songs From TerminalšŸŽµ

Online music players are totally bloated with ads, Its time to find an alternative

Music symbol and guitar to signify music.


I asked the same question myself, I had my reasons let us go through them

  • It looks cool on the internet
  • Reduces load on CPU caused by external media players
  • No ADS!!


For this you need two applications mpv and youtube-dl, mpv is used to play videos and songs, youtube-dl is used to download youtube audio and video.


# MacOS$ brew install youtube-dl mpv# Linux$ sudo apt-get install youtube-dl mpv
A Code Snippet from carbon


To get this to work it is simple create a folder to store your songs and cd into that directory. Go on to youtube and get the link for video song you want.

$ youtube-dl "<link>" -o "<output>"

If you only need the song not the video:

$ youtube-dl -F "<link>"

It give all the formats of the download that is possible, chose the id of the format that you need (Generally 140 .m4a works).

$ youtube-dl -f 140 "<link>" -o "<output.m4a>"

Now that the songs are downloaded we need to start playing them.

$ mpv <song>.m4a

If you want all the songs to play, use piping in terminal

$ ls | grep ".m4a" | xargs -r mpv

This will eliminate the need for other media players and remove the dependence on music websites. If you wish you can put this in a function and just call the function whenever you need directly from the terminal.

Check Out my other Blogs: BlogsšŸ“•.



Krishna Kotni. Website:

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store