Install the client on Ubuntu:
sudo apt update sudo apt install mosquitto-clients
The client is now installed and can be stated to Listen on a Topic:
mosquitto_sub -h localhost -t test
or with username and password:
mosquitto_sub -h localhost -t test -u "sammy" -P "password"