How to listen to Internet radio from the command line on Linux

For those of you system admins and Linux aficionados who spend a great deal of your time in front of Linux screen, do you know that ambient noise from online/local radio station can actually be a productivity booster? Believe or not, it is known that moderate level of ambient sound such as music or chatter can actually fuel your creativity at your workplace. If you like the idea of working with music on, maybe this tutorial is useful to you, as I am going to show you how to listen to Pandora online radio from the command line.

As you already know, Pandora is one of the most well-known Internet radio services, streaming tons of different genres of music for free, with its powerful music recommendation engine. While Pandora can be accessed in different ways such as via web browser, desktop clients or mobile apps, the open-source community has come up with yet another way to access Pandora: Linux command-line.

pianobar is an open-source CLI music player for Pandora Internet radio. It comes with a simple terminal interface for playing and managing music stations. Other features include song rating, upcoming song list, song history, custom keybindings, remote control, etc. For those listeners who live in the region where Pandora is not available (i.e., outside US, Australia and New Zealand), pianobar also comes with proxy support.

Install Pianobar on Linux

On Debian and other Debian-derivatives such as Ubuntu or Linux Mint, pianobar comes as a pre-built package, so installation is as easy as typing:

$ sudo apt-get install pianobar

On Fedora, pianobar is not available in base repositories. So you need to build it from the source. The whole installation process is a bit involved, but the following instructions will do it. The instructions were tested on fresh Fedora 20.

First, compile and install FFmpeg from the source using this guide.

Next, enable RPM Fusion repo, and install other prerequisites:

$ sudo yum install wget gcc-c++ pkgconfig gnutls-devel json-c-devel libgcrypt-devel make libao-devel faad2-devel libmad-devel libao faad2-libs

Compile and install pianobar:

$ wget
$ tar xvfvj pianobar-2014.06.08.tar.bz2
$ cd pianobar-2014.06.08
$ PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:$PKG_CONFIG_PATH make
$ sudo make install

Finally, to allow pianobar to load shared FFmpeg libraries installed in /usr/local/lib, add the following line in /etc/


and reload all shared libraries:

$ sudo ldconfig

That's it.

Listen to Pandora from the Command Line

The basic usage of pianobar is as simple as typing the command:

$ pianobar

You will be asked to log in to Pandora, and choose a station from your personalized station list. Once you pick a station, music streaming will start automatically.

Pressing '?' key during streaming will show you a list of available command keys. Some of them are:

  • s: change to a different station.
  • u: view a list of upcoming songs.
  • h: view plaback history.
  • n: go to the next song.
  • b: bookmark a song or an artist.
  • ( or ): decrease or increase music volume.
  • S: pause streaming.
  • P: resume streaming.
  • v: create a new station from song or artist.
  • + or -: thumb up or down a song.
  • a: add music to a station.
  • q: quit pianobar.

Configure Pianobar for Automatic Setup

You can define various default settings of pianobar in a separate configuration file. For example, you can put your Pandora login information in the configuration file, so you don't have to type it manually. Here is how to create a sample configuration file.

$ mkdir -p ~/.config/pianobar
$ vi ~/.config/pianobar/config
# Example pianobar configuration file

# Pandora login info
user = your@email_address
password = plaintext_password

# Users who cannot access Pandora in their region can set a proxy.
control_proxy = http://user:password@host:port/

# Initial volume in dB: between -30 and +5
volume = 0

# Audio quality: high, medium or low
audio_quality = high

For full configuration options, refer to its man page.

$ man pianobar

Remote Control Pianobar

Another excellent feature of pianobar is remote control support. You can send a command to a running instance of pianobar via a named pipe (FIFO). Here is how to remote control pianobar.

First create a FIFO in ~/.config/pianobar:

$ mkfifo ~/.config/pianobar/ctl

Then launch pianobar.

Now you can send any single-character command key to pianobar by using echo command. For example, to go to the next song:

$ echo -n 'n' > ~/.config/pianobar/ctl

You can easily extend this setup to a remote machine. When pianobar is running on host X, you can remote control pianobar from another host Y over SSH as follows.

On host Y, run:

$ ssh user@host_X "echo -n 'n' > ~/.config/pianobar/ctl"

Of course, you want to enable key authentication for SSH login to host X, so that you don't have to type an SSH password.

This remote control feature can come in handy when you want to set up a remote controllable Internet radio player on Raspberry Pi.

Hope you enjoy pianobar as much as I do. Let me know what you think of it in the comments.

Subscribe to Xmodulo

Do you want to receive Linux FAQs, detailed tutorials and tips published at Xmodulo? Enter your email address below, and we will deliver our Linux posts straight to your email box, for free. Delivery powered by Google Feedburner.

Support Xmodulo

Did you find this tutorial helpful? Then please be generous and support Xmodulo!

The following two tabs change content below.
Dan Nanni is the founder and also a regular contributor of He is a Linux/FOSS enthusiast who loves to get his hands dirty with his Linux box. He likes to procrastinate when he is supposed to be busy and productive. When he is otherwise free, he likes to watch movies and shop for the coolest gadgets.

17 thoughts on “How to listen to Internet radio from the command line on Linux

  1. Nice...did not know this. Using it now since it's less resource intensive than another tab on my browser :)

  2. Pianobar is cool, and since it uses libao, you can configure libao to use a driver that writes to disc.

  3. @Dan, this is pretty awesome for die hard command line people like me. This appears to bypass ads. I am listening for almost an hour w/ no ads :) I am using the fifo to control it but wondering if there is way to background it and always control via fifo?

  4. I use Pianobar all the time for work, but if someone could build an NPR app too I'd be thrilled.

  5. For my work days, i use this litle piece of shell:
    cvlc aacp_96.m3u &
    (this m3u is available on the swissjazz site)

  6. I got an error message after trying to log on. I have linux mint.

    Network error: TLS read failed. Thanks for any help

  7. I get the same error as Paul :

    $ pianobar
    Welcome to pianobar (2012.05.06)! Press ? for a list of commands.
    [?] Email: mac@*****************
    [?] Password:
    (i) Login... Network error: TLS handshake failed.

    • I had the same problems with the current Debian package. I cloned the source from Git Hub, installed the missing dependencies and compiled the program myself - TLS problems gone...runs great! If you need more info, just ask and I'll post the steps. I'm grooving to Duo Gadjo now :-)

  8. Korner
    try this, it may work for you. it worked for me on raspbian

    cd ~
    sudo apt-get update
    sudo apt-get purge pianobar
    sudo apt-get install git pkg-config libevent-pthreads-2.0-5 libao-dev libgnutls28-dev libmad0-dev libfaad-dev libjson0-dev libgcrypt11-dev
    sudo git clone git://
    cd pianobar
    sudo make clean
    sudo make
    sudo make install

    you're need to run the executable (pianobar) created from the directory pianobar as ./pianobar or alternally copy it to /usr/bin

    good luck

    i found it at the following web site

  9. Thanks, maihoa and the forum. I just followed these instructions and built pianobar and it runs great on my Debian wheezy (7.7) system now. I have been doing without if for a long time.

Leave a comment

Your email address will not be published. Required fields are marked *