busctlsystemdA monkey with a typewriterZbigniewJędrzejewski-Szmekzbyszek@in.waw.plbusctl1busctlIntrospect the busbusctlOPTIONSCOMMANDNAMEDescriptionbusctl may be used to
introspect and monitor the D-Bus bus.OptionsThe following options are understood:Connect to the bus specified by
ADDRESS instead of using suitable
defaults for either the system or user bus (see
and
options).When showing the list of endpoints, show a
column containing the names of containers they belong to.
See
systemd-machined.service8.
When showing the list of endpoints, show
only "unique" names (of the form
:number.number).
The opposite of —
only "well-known" names will be shown.When showing the list of endpoints, show
only endpoints which have actually not been activated yet,
but may be started automatically if accessed.When showing messages being exchanged, show only the
subset matching MATCH.Do not print the legend,
i.e. the column headers and the
footer.When used with the capture command
specifies the maximum bus message size to capture
("snaplen"). Defaults to 4096 bytes.When used with the tree command shows a
flat list of object paths instead of a tree.When used with the call command suppresses
display of the response message.When used with the call or
get-property command shows output in a
more verbose format.CommandsThe following commands are understood:listShow service names on the bus. This is the
default if no command is specified.statusSERVICEShow process information and credentials of a
bus service.monitorSERVICEDump messages being exchanged. If
SERVICE is specified, show messages
to or from this endpoint. Otherwise, show all messages on the
bus. Use Ctrl-C to terminate dump.captureSERVICESimilar to monitor but
writes the output in pcap format (for details see the Libpcap
File Format description. Make sure to redirect the
output to STDOUT to a file. Tools like
wireshark1
may be used to dissect and view the generated
files.treeSERVICEShows an object tree of one or more
services. If SERVICE is specified,
show object tree of the specified services only. Otherwise,
show all object trees of all services on the bus that acquired
at least one well-known name.introspectSERVICEOBJECTShow interfaces, methods, properties and
signals of the specified object (identified by its path) on
the specified service.callSERVICEOBJECTINTERFACEMETHODSIGNATUREARGUMENTInvoke a method and show the response. Takes a
service name, object path, interface name and method name. If
parameters shall be passed to the method call a signature
string is required, followed by the arguments, individually
formatted as strings. For details on the formatting used, see
below. To suppress output of the returned data use the
option.get-propertySERVICEOBJECTINTERFACEPROPERTYRetrieve the current value of one or more
object properties. Takes a service name, object path,
interface name and property name. Multiple properties may be
specified at once in which case their values will be shown one
after the other, separated by newlines. The output is by
default in terse format. Use for a
more elaborate output format.set-propertySERVICEOBJECTINTERFACEPROPERTYSIGNATUREARGUMENTSet the current value an object
property. Takes a service name, object path, interface name,
property name, property signature, followed by a list of
parameters formatted as strings.helpShow command syntax help.Parameter FormattingThe call and
set-property commands take a signature
string followed by a list of parameters formatted as string
(for details on D-Bus signature strings see the Type
system chapter of the D-Bus specification). For
simple types each parameter following the signature should
simply be the parameter's value formatted as
string. Positive boolean values may be formatted as
true, yes,
on, 1; negative
boolean values may be specified as false,
no, off,
0. For arrays, a numeric argument for the
number of entries followed by the entries shall be
specified. For variants the signature of the contents shall
be specified, followed by the contents. For dictionaries and
structs the contents of them shall be directly
specified.For example,
s jawoll is the formatting
of a single string jawoll.as 3 hello world foobar
is the formatting of a string array with three entries,
hello, world and
foobar.a{sv} 3 One s Eins Two u 2 Yes b true
is the formatting of a dictionary
array that maps strings to variants, consisting of three
entries. The string One is assigned the
string Eins. The string
Two is assigned the 32bit unsigned
integer 2. The string Yes is assigned a
positive boolean.Note that the call,
get-property,
introspect commands will also generate
output in this format for the returned data. Since this
format is sometimes too terse to be easily understood, the
call and get-property
commands may generate a more verbose, multi-line output when
passed the option.ExamplesWrite and Read a PropertyThe following two commands first write a
property and then read it back. The property is
found on the
/org/freedesktop/systemd1 object
of the org.freedesktop.systemd1
service. The name of the property is
LogLevel on the
org.freedesktop.systemd1.Manager
interface. The property contains a single
string:# busctl set-property org.freedesktop.systemd1 /org/freedesktop/systemd1 org.freedesktop.systemd1.Manager LogLevel s debug
# busctl get-property org.freedesktop.systemd1 /org/freedesktop/systemd1 org.freedesktop.systemd1.Manager LogLevel
s "debug"Terse and Verbose OutputThe following two commands read a property that
contains an array of strings, and first show it in
terse format, followed by verbose format:$ busctl get-property org.freedesktop.systemd1 /org/freedesktop/systemd1 org.freedesktop.systemd1.Manager Environment
as 2 "LANG=en_US.UTF-8" "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin"
$ busctl get-property --verbose org.freedesktop.systemd1 /org/freedesktop/systemd1 org.freedesktop.systemd1.Manager Environment
ARRAY "s" {
STRING "LANG=en_US.UTF-8";
STRING "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin";
};Invoking a MethodThe following command invokes a the
StartUnit method on the
org.freedesktop.systemd1.Manager
interface of the
/org/freedesktop/systemd1 object
of the org.freedesktop.systemd1
service, and passes it two strings
cups.service and
replace. As result of the method
call a single object path parameter is received and
shown:# busctl call org.freedesktop.systemd1 /org/freedesktop/systemd1 org.freedesktop.systemd1.Manager StartUnit ss "cups.service" "replace"
o "/org/freedesktop/systemd1/job/42684"See Alsodbus-daemon1,
D-Bus,
kdbus,
sd-bus3,
systemd1,
systemd-bus-proxyd8,
machinectl1,
wireshark1