Integration / D Bus Interview Questions
How do you use dbus-send?
dbus-send is a command-line tool for manually sending a D-Bus method call or signal from a shell, useful for testing a service or scripting simple interactions without writing a full client program.
dbus-send --system --print-reply \ --dest=org.freedesktop.systemd1 \ /org/freedesktop/systemd1 \ org.freedesktop.systemd1.Manager.ListUnits
The flags specify which bus to use (--system or --session), whether to wait for and print a reply, the destination service name via --dest, followed by the object path and then the fully qualified interface.method to call. Arguments, when needed, are passed with type prefixes like string: or int32: so the tool can build a correctly typed message.
It's a handy way to poke at a running service during development or debugging, though for anything beyond quick manual checks, most developers switch to a proper client library or the more modern busctl tool.
More Related questions...