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?


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.

  • Play is in the specs. It should work.
    – Oli
    Jul 6 '14 at 16:21
  • 1
    @Tim: Play doesn't work for me, either. Latest Spotify release here. Jul 6 '14 at 16:38
  • 1
    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
  • 2
    @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 Jul 6 '14 at 17:04
  • 1
    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

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

To install:

curl https://gist.githubusercontent.com/wandernauta/6800547/raw/db881a9100eb9b1e684c99962bde086a47ebcf08/sp | sudo tee /usr/local/bin/sp
sudo chmod +x /usr/local/bin/sp
  • 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 '16 at 14:58
  • @Tim Nope, simple stuff only. You could probably extend it if you know a little bash.
    – cmc
    Jan 13 '16 at 17:55

DBus commands for controlling spotify (from here), working for me on 17.10:


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


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

Play/Pause toggle

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


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


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

I have bound play/pause toggle to F12 in gnome.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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