LinuxCommandLibrary

dbus-send

Send messages to D-Bus

SYNOPSIS

dbus-send [--system|--session] [--dest=NAME] [--type=method_call|signal|method_return|error] [--print-reply[=literal]] [--reply-timeout=MS] [SERVICE::]PATH.MEMBER [PARAM...]

PARAMETERS

--system
    Send on the systemwide D-Bus (default if no --session)

--session
    Send on the user session D-Bus

--dest=NAME
    Destination service name (well-known bus name)

--type=TYPE
    method_call (default), signal, method_return, or error

--print-reply
    Wait for and print method reply

--print-reply-literal
    Print reply without value formatting

--reply-timeout=MS
    Timeout for reply in milliseconds (default 25000)

--help
    Display usage summary

--version
    Print version information

DESCRIPTION

dbus-send is a versatile command-line tool for sending messages over the D-Bus interprocess communication bus, widely used in Linux for IPC between applications and services.

It enables users and scripts to invoke remote methods, emit signals, or send replies without compiling code. Common targets include desktop environments (GNOME, KDE), media servers (PulseAudio), and system services (NetworkManager, systemd).

Specify the bus (--system for global or --session for user), destination service name, object path, interface.member, and parameters (e.g., string:foo, int32:42). Supports method calls (default), signals, errors, and returns.

--print-reply blocks for responses, useful for queries. Timeouts prevent hangs. It's low-level but powerful for automation, debugging, or testing D-Bus services.

Requires a running D-Bus daemon. Higher-level alternatives like qdbus or gdbus offer introspection.

CAVEATS

Requires running D-Bus daemon; fails silently if service unreachable or access denied (policykit/upstart). Positional args parse strictly by type. System bus often needs privileges. Avoid untrusted input to prevent injection.

EXAMPLES

dbus-send --print-reply --dest=org.freedesktop.login1 /org/freedesktop/login1 org.freedesktop.login1.Manager.GetSession string:1

Queries session info.

dbus-send --system --dest=org.freedesktop.UPower /org/freedesktop/UPower org.freedesktop.DBus.Introspectable.Introspect

Introspects UPower.

HISTORY

Developed as part of D-Bus (2002, Havoc Pennington for GNOME/DBUS project). dbus-send introduced in early 0.x releases (~2003); stable in 1.x series (2006+), used in distros like Ubuntu/Fedora. Minimal changes since, backward-compatible.

SEE ALSO

Copied to clipboard