← 返回命令列表

Linux command

gdbus 命令

文本

复制后可按需替换文件名、目录或参数。

常用示例

Example

gdbus list-names --session

Example

gdbus list-names --system

Introspect

gdbus introspect --session --dest [destination_bus_name] --object-path /[path/to/object]

Call a method

gdbus call --session --dest [destination_bus_name] --object-path /[path/to/object] --method [interface.method_name] [args...]

Emit a signal

gdbus emit --session --object-path /[path/to/object] --signal [interface.signal_name] [args...]

Monitor

gdbus monitor --session

说明

gdbus is a command-line tool for interacting with D-Bus, the inter-process communication system used extensively in Linux desktop environments. It's part of GLib and provides a way to inspect, call methods on, and monitor D-Bus objects. The session bus is used for user applications (desktop notifications, media players, etc.), while the system bus handles system-wide services (NetworkManager, UPower, etc.). Use introspect to discover available interfaces and methods on any D-Bus object before interacting with it.

参数

list-names
List all names on a bus
introspect
Introspect a remote object
call
Invoke a method on a remote object
emit
Emit a signal
monitor
Monitor a remote object
wait
Wait for a bus name to appear
--session
Connect to the session bus (user-specific)
--system
Connect to the system bus (system-wide)
--dest _NAME_
Destination bus name
--object-path _PATH_
D-Bus object path
--method _INTERFACE.METHOD_
Method to call
--signal _INTERFACE.SIGNAL_
Signal to emit

FAQ

What is the gdbus command used for?

gdbus is a command-line tool for interacting with D-Bus, the inter-process communication system used extensively in Linux desktop environments. It's part of GLib and provides a way to inspect, call methods on, and monitor D-Bus objects. The session bus is used for user applications (desktop notifications, media players, etc.), while the system bus handles system-wide services (NetworkManager, UPower, etc.). Use introspect to discover available interfaces and methods on any D-Bus object before interacting with it.

How do I run a basic gdbus example?

Run `gdbus list-names --session` in a terminal, then adjust file names, paths, flags, or remote targets for your system.

What does list-names do in gdbus?

List all names on a bus