mosquitto_sub command not found
Introduction
When you run more command in linux terminal / console, you get the following error message
mosquitto_sub: command not found
or when using sudo you get the following error message
sudo: mosquitto_sub: command not found
Solutions to mosquitto_sub: command not found
How To Fix mosquitto_sub: command not found in Ubuntu / Debian / Kali Linux / Raspbian
In Ubuntu mosquitto_sub is provided by mosquitto-clients package.
mosquitto-clients is:
This is two MQTT version 5.0/3.1.1/3.1 command line clients. mosquitto_pub can be used to publish messages to a broker and mosquitto_sub can be used to subscribe to a topic to receive messages.
MQTT provides a method of carrying out messaging using a publish/subscribe model. It is lightweight, both in terms of bandwidth usage and ease of implementation. This makes it particularly useful at the edge of the network where a sensor or other simple device may be implemented using an arduino for example.
To fix this problem, we can install more using the command below.
sudo apt-get -y install mosquitto-clients
This command might take some time to finish depending on your machine internet connection.
You can also use apt command to install mosquitto-clients.
sudo apt -y install mosquitto-clients
Or if you have aptitude installed you can use the following command.
sudo aptitude install mosquitto-clients
Summary
In this tutorial we learn how to fix mosquitto_sub command not found error in Ubuntu / Debian / Kali Linux or Raspbian distribution.