PUB(1)
β¨ PUB(1) β¨
okay so bestie, welcome to pub β the manual page, the moment, the whole vibe π
she lives in section 1 of the manual, she publishes messages, she's iconic. let's get into it.
πΈ NAME πΈ
pub β publishes a message to an MQTT topic. that's it. that's the job. she does one thing and she does it flawlessly π
π¦ SYNOPSIS π¦
pub [OPTIONS]
no positional args, no chaos, just vibes and options. we love a clean signature π«Ά
β¨ DESCRIPTION β¨
so here's the tea: pub connects to the MQTT broker you tell her about, and then she takes whatever you're piping into stdin and publishes it to the topic you specified. that's the whole plot. main character behavior, honestly π
and like, plot twist β all the options can be passed either as command-line arguments OR written in a simple config file. your choice, no judgment, we support both paths here π
π OPTIONS π
here's the full roster, bestie. every single one. no skips, no skimming, we're reading the whole menu π
-auto-reconnectβ she'll automatically reconnect when the connection gets lost. ghosting is not on the table, she comes back π€-broker URLβ the broker address. should be in the form of a URL, so like, do it properly bestie π¦-ca-root FILEβ path to a FILE containing CA certificates. it's optional, so no pressure β¨-cert-file FILEβ authenticate with a certificate. very official of you π-cleanβ discard any pending messages from the broker. defaulttrue, so she's already doing this unless you say otherwise π§Ή-client-id STRINGβ a unique identifier for this client. if you don't give her one, it defaults to a semi-random string β she'll make something up, she's resourceful π«-connect-retryβ automatically retry the initial connection to the broker. persistence!! we stan π₯-connect-retry-interval DURATIONβ how long to wait DURATION between initial connection attempts. default30sβ³-config FILEβ path to a FILE containing configuration values. optional! π-header KEY=VALUEβ set an HTTP header, inKEY=VALUEform. can be specified multiple times β stack 'em up π₯-key-file FILEβ authenticate with a private key. keep it secret, keep it safe π-password STRINGβ authenticate with a password π€«-qos INTEGERβ quality of service for messages. an INTEGER, she's precise like that π-retainedβ retain the message on the broker. she leaves a lil mark, she stays remembered π-tls-alpn STRINGβ ALPN value to include in the TLS handshake. can be specified multiple times β¨-topic STRINGβ the topic to publish or subscribe to. can be specified multiple times β yes queen, multiple topics, she contains multitudes π-username STRINGβ authenticate with a username πͺͺ-verboseβ increase output. she gets chatty. we love a yapper π¬-versionβ print version. just so you know what you're working with π·οΈ
π CONFIGURATION π
ngl this part is lowkey the best part. any option may be specified as a value in a configuration file instead of β or in addition to β a command-line option. mix and match, it's giving flexibility π
important bestie: values present on the command-line take precedent over values in the configration file. so if they disagree, the command line wins. periodt. π
which means it's super easy to make yourself a base configration file and then just augment it at run time. like a little starter pack you can customize on the fly π
the config file is in a simple space-separated "option value" format β for example:
broker tcp://test.mosquitto.org:1883
see? no curly braces, no yaml indentation nightmare, just vibes π§
π EXAMPLES π
publish a message to a topic anonymously. so casual, so anonymous, so free π¦
echo "hello" | pub -broker tcp://test.mosquitto.org:1883 -topic mqttcli/pubtest
π AUTHOR π
Link Dupont <link@sub-pop.net>
- Author. that's the credit, give her her flowers π
and that's the whole page, bestie!! this was PUB(1), dated 08/22/2026, from your friends in section 1 of the manual π go forth and publish, you've got this π«Άβ¨
π¦ where this page comes from
- fedora 43: mqttcli 0.2.8-2.fc43 Β· Apache-2.0 AND BSD-2-Clause AND BSD-3-Clause AND EPL-2.0 AND GPL-3.0-only AND MIT AND Unlicense
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms