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 am trying to be able to play, pause, chose next track or previous track from command line, but unfortunately no one seems to know how to do this (I have goggled repeatedly). I need it to be a command so that I can use it with blue proximity, so pause when I walk away. Are there any commands for this?

share|improve this question
up vote 7 down vote accepted

The Spotify client has supported the MPRIS2 DBUS specification for ~4 years. Simply put this means most media remote controls should be able to control it.

If you need command-line access, you can talk to it directly over DBUS. Here's an example I stole from Fran Diéguez:

dbus-send --print-reply --dest=org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.Pause

For more commands, see the MPRIS2 Player specifications.

share|improve this answer
Play is in the specs. It should work. – Oli Jul 6 '14 at 16:21
@Tim: Play doesn't work for me, either. Latest Spotify release here. – Glutanimate Jul 6 '14 at 16:38
I can't even get Spotify on this laptop. I would guess they've just been lazy (seriously, it would have taken them a minute to implement) and they've skipped separate Play and Pause commands. – Oli Jul 6 '14 at 16:44
@Oli: Probably. But then again from what I understand the Linux client is only developed one dev in their free-time. It's not officially supported by Spotify. With that in mind I can live with little faults like this – Glutanimate Jul 6 '14 at 17:04
Weird, the specs doesn't say "should", "must", etc. – Braiam Jul 6 '14 at 17:49

The following command works for me (Play or Pause):

qdbus org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.PlayPause
share|improve this answer

SP is a simple and effective command line tool to control spotify. It uses DBUS internally.

To install:

curl | sudo tee /usr/local/bin/sp
sudo chmod +x /usr/local/bin/sp
share|improve this answer
This looks neat - does it do any extras than DBUS? (e.g. more advanced play pause than just the toggle?). It's neat to see things like this, though! – Tim Jan 13 at 14:58
@Tim Nope, simple stuff only. You could probably extend it if you know a little bash. – cmc Jan 13 at 17:55

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.