How to play music on the terminal


Perhaps apart from my grandparents and deaf people, very few people do not use their computers to play music. It has become part of the digital life to listen to music while surfing, chatting, coding or gaming. And besides myriads of music player applications out there for you to choose with colorfully embelished graphic interfaces , today I will show you the most simple way to play music like a true Linux user, ie using the almighty terminal.

The easiest way to play music on the terminal is to use mplayer.  Almost every Linux distro has mplayer in the respiratory so the installation process is easy. Run

sudo apt-get install mplayer

if you’re using Ubuntu or the like distros, run

sudo pacman -S mplayer

if you’re using Archlinux. To play a specific song in your music folder, run

mpmayer /path/to/the/song/songname

 

how to play music in the linux terminal

For example, in the image above, I wanted to play the song Chuyen Hoa Sim .mp3 in my VNmusic folder, I just went to the directory then ran

mplayer “Chuyen Hoa Sim .mp3“

then enjoyed the music. If you want to play the whole folder, you need to add an asterisk behind the directory path like that

mplayer ~/Music/VNmusic/*

Mplayer is perhaps all you need if you just want to play music on the terminal, however, one thing I dislike about this way is that mplayer occupies the terminal so I have to open a new terminal to do something else.  But fortunately, there is a better way to play music on the terminal and the new application of my choice is XMMS2.

Just like mplayer, installing xmms2 is a piece of cake since it is already in the respiratory of almost every Linux distro. Run

sudo apt-get install xmms2

if you are using Ubuntu of the like distros, run

sudo pacman -S xmms2

if you are using Archlinux.

Using xmms2 requires few more steps than using mplayer. First of all, you need to clear the playlist first, or when you play music, the sample song Lament of Lost Dreams will be always played first. To do so, run nyxmms2 clear. After that, you need to add songs to your play list, run nyxmms2 add /path/to/file-or-folder. For example, if I want to add the songs in my VNmusic folder, I ran nyxmms2 add ~/Music/VNmusic, and if I just need to add one song only, I use nyxmms2 add ~/Music/VNmusic/”Chuyen Hoa Sim .mp3“. After that, to check your current playlist, run nyxmms2 list and to play the current playlist, run nyxmms2 play. And from now you can keep doing your work while enjoying the music without wasting any graphic resource of your computer. You can look at the image below to know how to run the commands.

play music in linux terminal

That is all the basic things  about xmms2 you need to know to play music on the terminal. Of course xmms2 also has other common features for a music player but I wont cover them here. If you want to know more, the xmms2 wiki will be the place to visit.

About pacesettergraam

A good and realistic person

Posted on September 13, 2012, in linux and tagged , . Bookmark the permalink. 2 Comments.

  1. anthonyvenable110

    Reblogged this on anthonyvenable110.

  2. anthonyvenable110

    Reblogged this on anthonyvenable110.

Leave a comment