Is there such a thing as list of available DBus services?
I've stumbled upon a few (like those provided by NetworkManager, Rhythmbox, Skype, HAL).
I wonder if I can find a rather complete list of provided services/interfaces.

up vote 79 down vote accepted

Session:

dbus-send --session           \
  --dest=org.freedesktop.DBus \
  --type=method_call          \
  --print-reply               \
  /org/freedesktop/DBus       \
  org.freedesktop.DBus.ListNames

System:

dbus-send --system            \
  --dest=org.freedesktop.DBus \
  --type=method_call          \
  --print-reply               \
  /org/freedesktop/DBus       \
  org.freedesktop.DBus.ListNames

You can also use DFeet if you prefer a GUI tool.

  • 1
    @don-crissti how to the to list all object-paths under a service with dbus-send or gdbus? – Khurshid Alam Jan 8 '15 at 9:06
  • 1
    @KhurshidAlam - I have added an answer here. – don_crissti May 15 '15 at 23:06

qdbusviewer is your best friend; it allows you to send D-bus messages as well:

qdbusviewer showing the Session Bus tab with three subpanels

  • Seems broken as of 2014. It lists the services but can't send messages.. – Pithikos Nov 6 '14 at 15:49
  • 3
    I can't even start it on Ubuntu 14.04. It fails with: qdbusviewer: could not exec '/usr/lib/i386-linux-gnu/qt4/bin/qdbusviewer': No such file or directory – kasperd Dec 28 '14 at 23:54
  • 3
    @Pithikos d-feet works as of today. – sherrellbc Oct 24 '16 at 7:37
  • @sherrellbc Please consider adding d-feet as an answer to make it more visible – mivk Feb 12 '17 at 14:18

The python way is the beautiful way.

System services:

import dbus
for service in dbus.SystemBus().list_names():
    print(service)

Session services:

import dbus
for service in dbus.SessionBus().list_names():
    print(service)
  • Upvoted. I asked a follow-up question to your answer. unix.stackexchange.com/questions/203410/… – user768421 May 15 '15 at 1:58
  • I have a question, in a Plasma 5 desktop environment, the service org.kde.Spectacle is used for taking screenshot (and it's working), but it is neither listed in system bus nor session bus, why is that? – Meow Nov 1 '16 at 12:20
  • To help those who may be looking: for at least python 2.7.13 and 3.6, the package needed for this is dbus-python, installable with pip install dbus-python. The python-dbus package is also available (I was unable to get in working in the 2 minutes I tried). – bschlueter Aug 30 '17 at 5:09

gdbus is part of glib2 and supports Bash completions. Here is how to use it (on Fedora):

bash-4.4$ source /usr/share/bash-completion/completions/gdbus
bash-4.4$ gdbus call --system --dest <TAB><TAB>

This will show all possible destinations. To get a list of the available interfaces DBus exports the org.freedesktop.DBus.ListNames method. You can call it by running:

gdbus call --system --dest org.freedesktop.DBus \
           --object-path /org/freedesktop/DBus  \
           --method org.freedesktop.DBus.ListNames

Unfortunately this leads to unreadable output. Fortunately the output is valid python, so this is possible:

gdbus call --system --dest org.freedesktop.DBus      \
           --object-path /org/freedesktop/DBus       \
           --method org.freedesktop.DBus.ListNames | \
    python -c 'import sys, pprint; pprint.pprint(eval(sys.stdin.read()))'

I don't usually do this, but is a nice trick to keep on sleeve. I use gdbus for introspecting and proving concepts before moving to code. The bash completion saves a lot of typing and avoid typos. Would be nice to have gdbus displaying a nicer output.

Your Answer

 

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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