dbus-monitor
Monitor D-Bus message traffic
SYNOPSIS
dbus-monitor [--system | --session] [--dest=NAME] [--address=ADDRESS] [--profile] [--monitor] [--version] [--help] [MATCHES]
PARAMETERS
--system
Monitor the system bus.
--session
Monitor the session bus (default if neither --system nor --session is specified, or if DBUS_SESSION_BUS_ADDRESS is set).
--dest=NAME
Only show messages sent to the specified D-Bus unique or well-known name.
--address=ADDRESS
Connect to a specific D-Bus address instead of the default session or system bus.
--profile
Show a breakdown of time spent on D-Bus messages, typically used for performance profiling.
--monitor
Become a 'monitor' on the bus. This often requires elevated privileges to see all messages.
--version
Print the version of dbus-monitor and exit.
--help
Print a help message and exit.
[MATCHES]
Optional D-Bus match rules to filter messages. For example: "type='signal',interface='org.freedesktop.DBus.Properties'". Multiple rules can be specified.
DESCRIPTION
dbus-monitor is a powerful command-line utility used to observe and debug D-Bus messages in real-time.
D-Bus is a crucial inter-process communication (IPC) mechanism widely adopted in Linux and other Unix-like operating systems, allowing applications and system components to communicate efficiently. dbus-monitor can display all messages sent on either the system bus (for system-wide services and privileged communication) or the session bus (for user-specific applications), making it an indispensable tool for debugging inter-process communication issues, understanding application behavior, or monitoring system events like hardware changes or network status updates.
It provides a raw, unfiltered view of the messages, including method calls (requests), signals (notifications), and errors (responses indicating failure), detailing critical information such as the sender, destination, object path, interface, member (method/signal name), and arguments. This deep insight helps developers and system administrators trace the flow of D-Bus communication, diagnose connectivity problems, or verify proper message exchanges.
CAVEATS
Permissions: To monitor the system bus or all messages on the session bus, you typically need root privileges or to be part of a group that allows D-Bus monitoring. Without appropriate permissions, you might only see messages originating from your own user session.
Volume of Output: On a busy system, dbus-monitor can produce a very large volume of output, making it difficult to find specific messages. Using match rules (`MATCHES`) is crucial for effective filtering.
Raw Output: The output is raw and can be verbose. Understanding D-Bus message structure (type, sender, destination, path, interface, member, arguments) is necessary to interpret the results effectively.
FILTERING MESSAGES
Using match rules is fundamental for effective monitoring. For example, to only see signals related to NetworkManager, you might use dbus-monitor --system "type='signal',interface='org.freedesktop.NetworkManager'". You can specify multiple match rules to narrow down the output even further.
INTERPRETING OUTPUT
Messages are typically displayed with their type (e.g., "signal", "method call", "error"), sender, destination, object path, interface, member, and arguments. Pay attention to the `serial` numbers to trace requests and responses, and `sender` and `destination` to understand communication flow.
HISTORY
D-Bus was developed by the freedesktop.org project to standardize inter-process communication on Linux and other Unix-like systems. It emerged as a solution for desktop environments (like GNOME and KDE) to communicate with system services and each other, replacing older, disparate IPC mechanisms. dbus-monitor was created as a fundamental tool within the D-Bus ecosystem to provide visibility into this communication, essential for debugging and development from the early days of D-Bus's adoption (around 2003-2004). Its core functionality has remained consistent, reflecting its foundational role.
SEE ALSO
dbus-send(1), dbus-daemon(1), busctl(1), d-feet(1)