Despite most distributions defaulting to use the Bash shell, we all know there is a good selection of alternatives. There's the original sh, of course, the geeky C shell (csh), Korn shell (ksh), and the increasingly popular Z shell (Zsh). Each one of these is well established and likely to be a simple configuration option or package install away. Xonsh, however, will need to be installed manually, usually as a Python pip package, although there's an AppImage available too. And installing via pip is a clue to why you might want to install xonsh in the first place, because it's a shell that's going to be of most use to Python developers and users.

Xonsh is a little like launching the Python interactive interpreter and still being able to run regular shell commands. It lets you easily execute all the commands you might expect, such as ls, mv, and echo, within a Python environment. As a Python programmer, you can type 3.14*3.14 to perform a calculation or even start to write code. You can import external modules and use literal data types and multiline input. Python environment variables take the same format as those for a normal shell environment, which is useful for doing programmatic evaluation, and you can use pipes too, just like with Bash. There's a configuration file you can populate with your own options, and the prompt can be customized just like other shell environments. If you spend most of your day programming in Python, using a shell environment where this can be extended to the way you interact with the operating system makes a lot of sense, especially as Python can be a lot more opinionated about what it permits and processes. Even if you're not (yet) a Python programmer, using xonsh might be a brilliant way to learn.

Project Website

Xonsh offers what it calls a superset of Python 3.6+ commands, including normal shell commands and environment variables.

MQTT client

MQTT Explorer

MQTT is one of those things that initially sounds complicated but is actually quite easy to understand – and profoundly powerful when you know how to use it. The project doesn't exactly do itself any favors, either, describing itself as "an OASIS standard messaging protocol for the Internet of Things (IoT)." Put simply, however, MQTT is an easy to understand protocol and architecture for sending messages, and one that can be easily used from almost any device to send updates to another. You might have a USB temperature sensor connected to a Raspberry Pi in your garage, for example, and you'd like to share its data with your Node-RED server in your home. This is where MQTT can help. A simple command-line client tool called mosquitto_pub can transform the output from your sensor into an MQTT message and publish this to a local client, launched with another command called mosquitto_sub. The result is the aggregation of all MQTT messages which can then be connected to an MQTT broker, such as Node-RED.

One interesting aspect to MQTT is that the receiving clients don't know what each receiving message contains, and this is where MQTT Explorer can help. MQTT messages themselves are structured and easily parsed thanks to their native JSON support, and MQTT is a beautifully designed client that can unfold these messages and help you explore their contents and track their changing values. You simply enter the details of the publishing server you wish to connect to, and the incoming messages are aggregated and listed in the main window. Unfolding these will show their values in the pane on the right, along with a histogram of changes and other viewing options. It's a great way to demystify MQTT and pull the parts you need into other software.

Project Website

MQTT is perfect for home automation, and MQTT Explorer can help you get the most from your sensor data.

Buy this article as PDF

Express-Checkout as PDF
Price $2.95
(incl. VAT)

Buy Linux Magazine

Get it on Google Play

US / Canada

Get it on Google Play

UK / Australia

Related content

comments powered by Disqus
Subscribe to our Linux Newsletters
Find Linux and Open Source Jobs
Subscribe to our ADMIN Newsletters

Support Our Work

Linux Magazine content is made possible with support from readers like you. Please consider contributing when you’ve found an article to be beneficial.

Learn More