Ubuntu: How to listen radio from terminal?


I am using Ubuntu 12.04.

While seeing around here i have gone through this But it didnt seems to be work with me . Here is my trail .

raja@badfox:~$ mplayer www.live365.com  MPlayer svn r34540 (Ubuntu), built with gcc-4.6 (C) 2000-2012 MPlayer Team  mplayer: could not connect to socket  mplayer: No such file or directory  Failed to open LIRC support. You will not be able to use your remote control.    Playing www.live365.com.  File not found: 'www.live365.com'  Failed to open www.live365.com.      Exiting... (End of file)  

Its looks like some background work needed .


Try this.


The IP-address of an online radio station can be found over at Xat radio search.

My result :

enter image description here


There is indeed some "background work" to be done.

First of all, you will need to get hold of a URL that points to a real stream and not just a site that offers internet radio listening. This is probably the hardest part. You can search the station's website or google if there are any streams for that particular station. The stream URL is not the URL of a player on the station's website.

A URL might look like this: http://bbc.co.uk/radio/listen/live/r1.asx (BBC Radio 1) or http://www.bbc.co.uk/radio/listen/live/r1_aaclca.pls (BBC Radio 1, but a different URL) or http://www.ndr.de/resources/metadaten/audio/m3u/ndrloop5.m3u (N-Joy); it will (very likely) not look like www.live365.com.

All of the above may be played back easily using mplayer -playlist "<your url>", if that does not work with your stream, you can try mplayer "<your url>".


You can try moc. MOC (music on console) is a console audio player for LINUX/UNIX designed to be powerful and easy to use.


mplayer in IPv4 networks

If your router only works with IPv4, you will need to add the option -prefer-ipv4. More recent mplayer versions require this.

mplayer -prefer-ipv4  

See below to read how to use mplayer with .m3u and .pls streams.

Using VLC from the command line

As usual, VLC does it all:

cvlc  cvlc us.darkmatter.aac.48k.m3u   

cmus also opens .m3u and .pls streams

Unlike mplayer, cmus also knows to open .m3u and .pls streams. This means less digging or "background work" to extract the stream URL from those files.

Furthermore, cmus looks nice and offers several views, a file browser and many configuration settings. cmus is available from the standard Ubuntu repositories. To get up to speed with cmus, first read the tutorial by typing the following command:

$ man cmus-tutorial  


Open .m3u and .pls streams with mplayer on IPv4 networks

If you do not like cmus, or it is unavailable, mplayer can still be made to do the same. For that purpose, I wrote the following mplay script:

#!/bin/bash  URL=$(grep -m 1 --null http "$1" |sed s/^.*http/http/ |tr -d '\r')  mplayer -prefer-ipv4 "$URL"  


First, if you do not include "http://", then mplayer will try to open a file called "www.live365.com".

mplayer http://www.live365.com  

This, however, will fail as well, since http://www.live365.com is not an address of a stream that mplayer could play, but of a web page. With a flash player.

Short answer -- open the website in firefox or another browser and click on "play".


I had the same problem. What I've done to get access to streams via command line is use the 'view source' to get the url of the stream.

For example, http://www.francebleu.fr/player opens in a browser and has buttons to play and stop etc. Then I right-click and select 'view source' and another page opens. I searched for mp3, (or you can search for "http://"), somewhere in there you'll find the link that is actually being used. In the example here, it turned out to be sort of hidden...


But from that I got the link by removing the forward slashes. Thus finally, from the command line I execute "mplayer http://mp3.live.tv-radio.com/fbidf/all/fbidfhautdebit.mp3" and mplayer can process that stream.

Hope that helps.

Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Next Post »