1BUSCTL(1)                           busctl                           BUSCTL(1)
2
3
4

NAME

6       busctl - Introspect the bus
7

SYNOPSIS

9       busctl [OPTIONS...] [COMMAND] [NAME...]
10

DESCRIPTION

12       busctl may be used to introspect and monitor the D-Bus bus.
13

COMMANDS

15       The following commands are understood:
16
17       list
18           Show all peers on the bus, by their service names. By default,
19           shows both unique and well-known names, but this may be changed
20           with the --unique and --acquired switches. This is the default
21           operation if no command is specified.
22
23       status [SERVICE]
24           Show process information and credentials of a bus service (if one
25           is specified by its unique or well-known name), a process (if one
26           is specified by its numeric PID), or the owner of the bus (if no
27           parameter is specified).
28
29       monitor [SERVICE...]
30           Dump messages being exchanged. If SERVICE is specified, show
31           messages to or from this peer, identified by its well-known or
32           unique name. Otherwise, show all messages on the bus. Use Ctrl+C to
33           terminate the dump.
34
35       capture [SERVICE...]
36           Similar to monitor but writes the output in pcapng format (for
37           details, see PCAP Next Generation (pcapng) Capture File Format[1]).
38           Make sure to redirect standard output to a file or pipe. Tools like
39           wireshark(1) may be used to dissect and view the resulting files.
40
41       tree [SERVICE...]
42           Shows an object tree of one or more services. If SERVICE is
43           specified, show object tree of the specified services only.
44           Otherwise, show all object trees of all services on the bus that
45           acquired at least one well-known name.
46
47       introspect SERVICE OBJECT [INTERFACE]
48           Show interfaces, methods, properties and signals of the specified
49           object (identified by its path) on the specified service. If the
50           interface argument is passed, the output is limited to members of
51           the specified interface.
52
53       call SERVICE OBJECT INTERFACE METHOD [SIGNATURE [ARGUMENT...]]
54           Invoke a method and show the response. Takes a service name, object
55           path, interface name and method name. If parameters shall be passed
56           to the method call, a signature string is required, followed by the
57           arguments, individually formatted as strings. For details on the
58           formatting used, see below. To suppress output of the returned
59           data, use the --quiet option.
60
61       emit OBJECT INTERFACE SIGNAL [SIGNATURE [ARGUMENT...]]
62           Emit a signal. Takes an object path, interface name and method
63           name. If parameters shall be passed, a signature string is
64           required, followed by the arguments, individually formatted as
65           strings. For details on the formatting used, see below. To specify
66           the destination of the signal, use the --destination= option.
67
68       get-property SERVICE OBJECT INTERFACE PROPERTY...
69           Retrieve the current value of one or more object properties. Takes
70           a service name, object path, interface name and property name.
71           Multiple properties may be specified at once, in which case their
72           values will be shown one after the other, separated by newlines.
73           The output is, by default, in terse format. Use --verbose for a
74           more elaborate output format.
75
76       set-property SERVICE OBJECT INTERFACE PROPERTY SIGNATURE ARGUMENT...
77           Set the current value of an object property. Takes a service name,
78           object path, interface name, property name, property signature,
79           followed by a list of parameters formatted as strings.
80
81       help
82           Show command syntax help.
83

OPTIONS

85       The following options are understood:
86
87       --address=ADDRESS
88           Connect to the bus specified by ADDRESS instead of using suitable
89           defaults for either the system or user bus (see --system and --user
90           options).
91
92       --show-machine
93           When showing the list of peers, show a column containing the names
94           of containers they belong to. See systemd-machined.service(8).
95
96       --unique
97           When showing the list of peers, show only "unique" names (of the
98           form ":number.number").
99
100       --acquired
101           The opposite of --unique — only "well-known" names will be shown.
102
103       --activatable
104           When showing the list of peers, show only peers which have actually
105           not been activated yet, but may be started automatically if
106           accessed.
107
108       --match=MATCH
109           When showing messages being exchanged, show only the subset
110           matching MATCH. See sd_bus_add_match(3).
111
112       --size=
113           When used with the capture command, specifies the maximum bus
114           message size to capture ("snaplen"). Defaults to 4096 bytes.
115
116       --list
117           When used with the tree command, shows a flat list of object paths
118           instead of a tree.
119
120       -q, --quiet
121           When used with the call command, suppresses display of the response
122           message payload. Note that even if this option is specified, errors
123           returned will still be printed and the tool will indicate success
124           or failure with the process exit code.
125
126       --verbose
127           When used with the call or get-property command, shows output in a
128           more verbose format.
129
130       --xml-interface
131           When used with the introspect call, dump the XML description
132           received from the D-Bus
133           org.freedesktop.DBus.Introspectable.Introspect call instead of the
134           normal output.
135
136       --json=MODE
137           When used with the call or get-property command, shows output
138           formatted as JSON. Expects one of "short" (for the shortest
139           possible output without any redundant whitespace or line breaks) or
140           "pretty" (for a pretty version of the same, with indentation and
141           line breaks). Note that transformation from D-Bus marshalling to
142           JSON is done in a loss-less way, which means type information is
143           embedded into the JSON object tree.
144
145       -j
146           Equivalent to --json=pretty when invoked interactively from a
147           terminal. Otherwise equivalent to --json=short, in particular when
148           the output is piped to some other program.
149
150       --expect-reply=BOOL
151           When used with the call command, specifies whether busctl shall
152           wait for completion of the method call, output the returned method
153           response data, and return success or failure via the process exit
154           code. If this is set to "no", the method call will be issued but no
155           response is expected, the tool terminates immediately, and thus no
156           response can be shown, and no success or failure is returned via
157           the exit code. To only suppress output of the reply message
158           payload, use --quiet above. Defaults to "yes".
159
160       --auto-start=BOOL
161           When used with the call or emit command, specifies whether the
162           method call should implicitly activate the called service, should
163           it not be running yet but is configured to be auto-started.
164           Defaults to "yes".
165
166       --allow-interactive-authorization=BOOL
167           When used with the call command, specifies whether the services may
168           enforce interactive authorization while executing the operation, if
169           the security policy is configured for this. Defaults to "yes".
170
171       --timeout=SECS
172           When used with the call command, specifies the maximum time to wait
173           for method call completion. If no time unit is specified, assumes
174           seconds. The usual other units are understood, too (ms, us, s, min,
175           h, d, w, month, y). Note that this timeout does not apply if
176           --expect-reply=no is used, as the tool does not wait for any reply
177           message then. When not specified or when set to 0, the default of
178           "25s" is assumed.
179
180       --augment-creds=BOOL
181           Controls whether credential data reported by list or status shall
182           be augmented with data from /proc/. When this is turned on, the
183           data shown is possibly inconsistent, as the data read from /proc/
184           might be more recent than the rest of the credential information.
185           Defaults to "yes".
186
187       --watch-bind=BOOL
188           Controls whether to wait for the specified AF_UNIX bus socket to
189           appear in the file system before connecting to it. Defaults to off.
190           When enabled, the tool will watch the file system until the socket
191           is created and then connect to it.
192
193       --destination=SERVICE
194           Takes a service name. When used with the emit command, a signal is
195           emitted to the specified service.
196
197       --user
198           Talk to the service manager of the calling user, rather than the
199           service manager of the system.
200
201       --system
202           Talk to the service manager of the system. This is the implied
203           default.
204
205       -H, --host=
206           Execute the operation remotely. Specify a hostname, or a username
207           and hostname separated by "@", to connect to. The hostname may
208           optionally be suffixed by a port ssh is listening on, separated by
209           ":", and then a container name, separated by "/", which connects
210           directly to a specific container on the specified host. This will
211           use SSH to talk to the remote machine manager instance. Container
212           names may be enumerated with machinectl -H HOST. Put IPv6 addresses
213           in brackets.
214
215       -M, --machine=
216           Execute operation on a local container. Specify a container name to
217           connect to, optionally prefixed by a user name to connect as and a
218           separating "@" character. If the special string ".host" is used in
219           place of the container name, a connection to the local system is
220           made (which is useful to connect to a specific user's user bus:
221           "--user --machine=lennart@.host"). If the "@" syntax is not used,
222           the connection is made as root user. If the "@" syntax is used
223           either the left hand side or the right hand side may be omitted
224           (but not both) in which case the local user name and ".host" are
225           implied.
226
227       -l, --full
228           Do not ellipsize the output in list command.
229
230       --no-pager
231           Do not pipe output into a pager.
232
233       --no-legend
234           Do not print the legend, i.e. column headers and the footer with
235           hints.
236
237       -h, --help
238           Print a short help text and exit.
239
240       --version
241           Print a short version string and exit.
242

PARAMETER FORMATTING

244       The call and set-property commands take a signature string followed by
245       a list of parameters formatted as string (for details on D-Bus
246       signature strings, see the Type system chapter of the D-Bus
247       specification[2]). For simple types, each parameter following the
248       signature should simply be the parameter's value formatted as string.
249       Positive boolean values may be formatted as "true", "yes", "on", or
250       "1"; negative boolean values may be specified as "false", "no", "off",
251       or "0". For arrays, a numeric argument for the number of entries
252       followed by the entries shall be specified. For variants, the signature
253       of the contents shall be specified, followed by the contents. For
254       dictionaries and structs, the contents of them shall be directly
255       specified.
256
257       For example,
258
259           s jawoll
260
261       is the formatting of a single string "jawoll".
262
263           as 3 hello world foobar
264
265       is the formatting of a string array with three entries, "hello",
266       "world" and "foobar".
267
268           a{sv} 3 One s Eins Two u 2 Yes b true
269
270       is the formatting of a dictionary array that maps strings to variants,
271       consisting of three entries. The string "One" is assigned the string
272       "Eins". The string "Two" is assigned the 32-bit unsigned integer 2. The
273       string "Yes" is assigned a positive boolean.
274
275       Note that the call, get-property, introspect commands will also
276       generate output in this format for the returned data. Since this format
277       is sometimes too terse to be easily understood, the call and
278       get-property commands may generate a more verbose, multi-line output
279       when passed the --verbose option.
280

EXAMPLES

282       Example 1. Write and Read a Property
283
284       The following two commands first write a property and then read it
285       back. The property is found on the "/org/freedesktop/systemd1" object
286       of the "org.freedesktop.systemd1" service. The name of the property is
287       "LogLevel" on the "org.freedesktop.systemd1.Manager" interface. The
288       property contains a single string:
289
290           # busctl set-property org.freedesktop.systemd1 /org/freedesktop/systemd1 org.freedesktop.systemd1.Manager LogLevel s debug
291           # busctl get-property org.freedesktop.systemd1 /org/freedesktop/systemd1 org.freedesktop.systemd1.Manager LogLevel
292           s "debug"
293
294       Example 2. Terse and Verbose Output
295
296       The following two commands read a property that contains an array of
297       strings, and first show it in terse format, followed by verbose format:
298
299           $ busctl get-property org.freedesktop.systemd1 /org/freedesktop/systemd1 org.freedesktop.systemd1.Manager Environment
300           as 2 "LANG=en_US.UTF-8" "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin"
301           $ busctl get-property --verbose org.freedesktop.systemd1 /org/freedesktop/systemd1 org.freedesktop.systemd1.Manager Environment
302           ARRAY "s" {
303                   STRING "LANG=en_US.UTF-8";
304                   STRING "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin";
305           };
306
307       Example 3. Invoking a Method
308
309       The following command invokes the "StartUnit" method on the
310       "org.freedesktop.systemd1.Manager" interface of the
311       "/org/freedesktop/systemd1" object of the "org.freedesktop.systemd1"
312       service, and passes it two strings "cups.service" and "replace". As a
313       result of the method call, a single object path parameter is received
314       and shown:
315
316           # busctl call org.freedesktop.systemd1 /org/freedesktop/systemd1 org.freedesktop.systemd1.Manager StartUnit ss "cups.service" "replace"
317           o "/org/freedesktop/systemd1/job/42684"
318

SEE ALSO

320       dbus-daemon(1), D-Bus[3], sd-bus(3), systemd(1), machinectl(1),
321       wireshark(1)
322

NOTES

324        1. PCAP Next Generation (pcapng) Capture File Format
325           https://github.com/pcapng/pcapng/
326
327        2. Type system chapter of the D-Bus specification
328           https://dbus.freedesktop.org/doc/dbus-specification.html#type-system
329
330        3. D-Bus
331           https://www.freedesktop.org/wiki/Software/dbus
332
333
334
335systemd 254                                                          BUSCTL(1)
Impressum