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