Link Search Menu Expand Document Edit GitHub


Open MQTT CLI in an interactive shell session. The shell uses JLine for handling console input. Therefore, tab-completion, command-history, password-masking and other familiar shell features are available.

The Shell-Mode is based around a client context driven use case. Therefore, methods like Connect and Disconnect switch the current context of the shell and commands like Publish and Subscribe always relate to the currently active client context.

mqtt shell

Alias: mqtt sh


$ mqtt shell                # starts the shell

mqtt> con -i myClient                # connect client with identifier 'myClient'
myClient@host> pub -t test -m msg    # publish the message 'msg' with the new context client
myClient@host> dis                   # disconnect and remove context
mqtt> ...

NOTE: A client is uniquely identified in the CLI by the hostname and the unique identifier.


CommandExplanationRequires active client context
connectSee Connect 
disconnectSee Disconnect 
publishSee PublishX
subscribeSee SubscribeX
unsubscribeSee UnsubscribeX
switchSee Switch 
listSee List 
clearSee Clear 
exitSee Exit 


Logging Options

OptionLong VersionExplanationDefault
-l Log to ~./mqtt-cli/logs (Configurable through ~/.mqtt-cli/

Help Options

OptionLong VersionExplanation
-h--helpDisplay help message for command.
-V--versionDisplay version information of the cli.

Table of contents