1SUB(1) SUB(1)
2
3
4
6 sub - subscribe to MQTT topics
7
9 sub [OPTIONS]
10
12 sub connects to the given MQTT broker and subscribes to all topics
13 specified. Messages received on a topic are printed to stdout, prefixed
14 with the topic the message was received on.
15
16 All options can be passed either as command-line arguments or can be
17 specified in a simple config file.
18
20 -broker URL
21 broker address (should be in the form of a URL)
22
23 -ca-root FILE
24 path to a FILE containing CA certificates (optional)
25
26 -cert-file FILE
27 authenticate with a certificate
28
29 -clean
30 discard any pending messages from the broker (default true)
31
32 -client-id STRING
33 unique identifier for this client (defaults to a semi-random
34 string)
35
36 -config FILE
37 path to FILE containing configuration values (optional)
38
39 -header KEY=VALUE
40 set an HTTP header (in KEY=VALUE form) (can be specified multiple
41 times)
42
43 -key-file FILE
44 authenticate with a private key
45
46 -password STRING
47 authenticate with a password
48
49 -qos INTEGER
50 quality of service for messages
51
52 -topic STRING
53 topic to publish or subscribe to (can be specified multiple times)
54
55 -username STRING
56 authenticate with a username
57
58 -verbose
59 increase output
60
62 Any option may be specified as a value in a configuration file instead
63 of (or in addition to) a command-line option. Values present on the
64 command-line take precedent over values in the configration file. Thus
65 it is easy to create a base configration file that can be augmented
66 easily at run time.
67
68 The configuration file takes the form of a simple space-separated
69 "option value" format (i.e. "broker tcp://test.mosquitto.org:1883").
70
72 Connect to a broker anonymously and subscribe to two topics.
73
74 sub -broker tcp://test.mosquitto.org:1883 -topic mqttcli/pubtest -topic mqttcli/pubtest1
75
76 Connect to a broker using username/password authentication and
77 subscribe to a topic.
78
79 sub -broker tcp://test.mosquitto.org:1884 -username ro -password readonly -topic mqttcli/pubtest
80
82 Link Dupont <link@sub-pop.net>
83 Author.
84
85
86
87 06/18/2022 SUB(1)