dbus-send
Send messages to D-Bus
SYNOPSIS
dbus-send [--system | --session] [--dest=NAME] [--type=TYPE] [--print-reply] object_path method_name [signature] [arguments ...]
PARAMETERS
--system
Connect to the system bus.
--session
Connect to the session bus. (default)
--dest=NAME
Specify the destination bus name.
--type=TYPE
Specify the message type (method_call, method_return, error, signal). Defaults to method_call.
--print-reply
Print the reply to standard output.
object_path
The object path of the target object.
method_name
The name of the method to call.
[signature]
The signature string describing the arguments (e.g., 's' for string, 'i' for integer).
[arguments ...]
The arguments to pass to the method.
DESCRIPTION
dbus-send is a command-line tool used to send messages to the D-Bus daemon, which facilitates inter-process communication on Linux systems. It's invaluable for debugging, testing, and interacting with services that expose their functionality through D-Bus. You can use it to call methods, set properties, and send signals. The command requires knowing the destination bus name, the object path, the interface name, and the method to call, along with any necessary arguments.
Essentially, it allows users to remotely control and query applications and system services via the D-Bus protocol without needing to write custom code. dbus-send makes it easy to script interactions and automate tasks that rely on D-Bus.
CAVEATS
Requires understanding of D-Bus concepts like bus names, object paths, interfaces, and signatures. Incorrectly formatted arguments or invalid bus names can lead to errors. Security considerations should be taken into account when sending messages to system services.
EXAMPLES
Example 1: Calling a method with no arguments: dbus-send --session --dest=org.freedesktop.Notifications /org/freedesktop/Notifications org.freedesktop.Notifications.Close uint32:1234
Example 2: Calling a method with arguments:dbus-send --session --dest=org.freedesktop.Notifications /org/freedesktop/Notifications org.freedesktop.Notifications.Notify string:"MyApp" uint32:0 string:"dialog-information" string:"Hello" string:"This is a notification" array:string:[] dict:string:variant:{} int32:5000
HISTORY
dbus-send was created as part of the D-Bus project, which aimed to provide a standardized way for applications to communicate with each other and the operating system on Linux. It's evolved along with the D-Bus standard, with updates to support new features and improve security.
SEE ALSO
dbus-daemon(1), dbus-monitor(1), gdbus(1)