Forrest logo
tool overview
On this page you find all important commands for the CLI tool mosquitto_sub. If the command you are looking for is missing please ask our AI.


Mosquitto_sub is a command-line tool used for subscribing to MQTT (Message Queuing Telemetry Transport) topics and receiving messages from an MQTT broker.

  1. It is a part of the Mosquitto MQTT broker package and is specifically designed for subscribers.
  2. The tool allows you to connect to an MQTT broker and subscribe to one or multiple topics.
  3. Mosquitto_sub provides a flexible and efficient way to monitor MQTT communication and receive messages in real-time.
  4. It supports various authentication methods and can handle both unencrypted and encrypted MQTT connections.
  5. Mosquitto_sub can subscribe to wildcard topics, allowing you to receive messages from multiple topics that match a given pattern.
  6. It supports Quality of Service (QoS) levels 0, 1, and 2, allowing you to choose message reliability and delivery guarantees.
  7. The tool displays the received messages in the terminal, including the topic, message payload, and other relevant information.
  8. It can be used with various platforms and operating systems, including Windows, macOS, and Linux.
  9. Mosquitto_sub can be combined with other command-line tools or scripts to create complex MQTT monitoring and data processing workflows.
  10. It is highly customizable with several command-line options to adjust connection settings, verbosity levels, and more.

Overall, mosquitto_sub is a powerful and versatile command-line tool that enables easy MQTT topic subscription, message retrieval, and efficient communication monitoring.

List of commands for mosquitto_sub:

  • mosquitto_sub:tldr:08657 mosquitto_sub: Subscribe to multiple topics matching a given pattern. (+ takes any metric name).
    $ mosquitto_sub -t ${sensors-machines-+-temperature-+}
    try on your machine
    explain this command
  • mosquitto_sub:tldr:7d3eb mosquitto_sub: Subscribe to all broker status messages publishing on `` port 1885 and print published messages verbosely.
    $ mosquitto_sub -v -h "" -p 1885 -t ${\$SYS-#}
    try on your machine
    explain this command
  • mosquitto_sub:tldr:b396a mosquitto_sub: Subscribe to the topic `sensors/temperature` information with Quality of Service (`QoS`) set to 1. (The default hostname is `localhost` and port 1883).
    $ mosquitto_sub -t ${sensors-temperature} -q ${1}
    try on your machine
    explain this command
tool overview