Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I love Banshee media player in general, and I already have an important library of music, which I've spent a lot of time organizing (labeling, correcting, etc).

I also use the command line a lot, so I wonder if there is a way I can control banshee from the command line. As in:

  • Next, Prev, Stop, Play, etc
  • In anyway query the Banshee database as if using the search box in the GUI

I was akin to program it myself if there isn't, but that would be another question :)

share|improve this question
up vote 17 down vote accepted

According to man banshee, it is possible to control playback. I'm not sure about searching though.

Here are a few of the controls that you mentioned. Check the man page for many more.

    Play the next track, optionally restarting if the 'restart' value is set

    Play the previous track, optionally restarting if the 'restart value is set

    Completely stop playback

    Start playback
share|improve this answer
Doh!, I guess need to RTFM!, thanks for pointing that out. There are plenty of options but looks like I can't query the database. the query-* commands are just for printing information on the stdout. :-/ – tutuca Aug 6 '10 at 21:45
Yeah, looks like the query arguments are only for getting info about the current track. Not quite what you're looking for. – mac9416 Aug 6 '10 at 22:01
BTW, If this answer actually answers your question, please hit the checkmark beside it. – mac9416 Aug 9 '10 at 23:30
banshee stores in a SQLite database. From there you could do queries. – hgoebl Jan 16 at 9:47
/usr/bin/banshee --next
/usr/bin/banshee --previous
/usr/bin/banshee --stop
/usr/bin/banshee --play

All those above can be used in XFCE for shortcuts on your keyboard, respectively for:

share|improve this answer

If you're looking to program an interface for Banshee (Other than just having the ability to send banshee --next or other control flag. Then you may be interested in the MPD - The Music Player Daemon which allows you to create your own interface or modify/use one of these Clients designed to work over MPD

share|improve this answer

There are quite a bit of commands you can use with banshee, it's been a ling time now, but here's a script I wrote because I could not find a way to play a smart playlist at login. It was months ago, it was one of my first scripts and I did it for fun so it's pretty bad, I haven't tried it since but this should at least give you an example of how usable is banshee on the terminal :

    banshee --hide &
    sleep 3;
    banshee --play;

    while true; do
        pos=`banshee --query-position| sed s/position:\ //| sed s/,.*//`;
        dur=`banshee --query-duration| sed s/duration:\ //| sed s/,.*//`;
        left="$(expr $dur - $pos)";

        rating=`banshee --query-rating|sed s/rating:\ //`;
        isHumour="$(banshee --query-uri|sed s/.*Music//|grep /Humour)";

      if [[ $pos -lt "3" ]] && ([[ $rating -lt "2" ]] || [[ -n "$isHumour" ]]);
        echo "next";
        exec banshee --next &
        echo "sleep for" $left;
        sleep "$left";
        pos=`banshee --query-position| sed s/position:\ //| sed s/,.*//`;
        dur=`banshee --query-duration| sed s/duration:\ //| sed s/,.*//`;
        left= expr $dur - $pos;
        echo $left;
    sleep 0.0001;
    exit 0;

Hope it helps, sorry if it confuses you...

share|improve this answer

I don't think there is a command-line interface to Banshee at this point. And I haven't heard anything to indicate that they would be working on one.

share|improve this answer
I think tutuca is just looking for a way to control Banshee from the command line; not a full-out command line interface (though that would be very cool). – mac9416 Aug 6 '10 at 22:09

Here is what everyone has been looking for:

sh -c "sleep 1m; banshee --hide & sleep 20; banshee --play"

the 1m stands for a timeout which you can change.

You need to put it in your start up applications

share|improve this answer
Can you explain how this allows what the OP was asking? Next, Prev, Stop, Play, Search database? – DrSAR Feb 25 '13 at 5:35

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.