Xonsh: Cross-Platform Command Prompt and Shell Language

Xonsh: Cross-Platform Command Prompt and Shell Language

Xonsh: Cross-Platform Command Prompt and Shell Language

These recent days I have been browsing the Internet, looking for useful information related to Shell scripting. In order to update the code of a useful little software tool that I created a little over a decade ago. Application that at the time, was called Linux Post Install – Bicentennial Script (LPI-SB), and was generated only with Bash-based command prompts. And in the middle of that search I have come across an interesting utility or program called "Xonsh".

For those who have never heard of this application, it is worth mentioning that it is a great tool for terminal software offering a shell language and a Cross-platform command prompt That works with Python.

Shell scripting

And as usual, before we dive into today's topic of Terminal tools and uses, and more specifically about the useful application called  "Xonsh", we will leave for those interested the following links to some previous related posts. In such a way that they can easily explore them, if necessary, after finishing reading this publication:

“Shell Scripting is the technique (skill) of designing and creating Script (task automation file) through a Shell (preferably) of an Operating System, or a Text Editor (Graphic or Terminal). This is a type of programming language that is generally interpreted. That is, while most programs are compiled (encrypted), because they are permanently converted to a specific (special) code before they can be executed (compilation process), a shell script remains in its original form (its code source in text form) and are interpreted command by command each time they are executed". Shell, Bash and Scripts: All about Shell Scripting

Related article:
Online Resources and Utilities for Learning Shell Scripting

Related article:
Build your program step by step using Shell Scripting - Part 1

Xonsh: Shell for Bash, Python and more

Xonsh: Shell for Bash, Python and more

What is Xonsh?

According to his Official website, the application "Xonsh" It is briefly described as follows:

"It is a shell powered by Python. A cross-platform shell language and command prompt powered by Python. The language is a superset of Python 3.6+ with some additional shells that you're used to from Bash and Python. It works on all major systems including Linux, OSX and Windows. Xonsh is intended for daily use by experts and novices".

However, they later add that with her:

"Any terminal user can easily mix Python and Shell commands (such as Bash) in a powerful and simplified command line approach".

Which, in simpler words, means that when executing "Xonsh" we are offered a Shell or terminal environment where we can run both simple commands and Complex Bash Shell Command Prompts and Python. Which can be extremely useful, both for SysAdmin and Devs, as for terminal enthusiasts and beginners, either to learn or to start working.


Currently, "Xonsh" goes for his last version of number 0.11.0, released the day 17/11/21. And it can be installed in many ways, for example, by console, in a traditional way with the usual package manager used in each GNU/Linux Distro, as by the manager python pip, or via an AppImage file or using Docker.

Among its general characteristics or functions has the following:

  1. Allows you to combine (Bash) Shell commands with Python or vice versa.
  2. It allows the use of third-party extensions, xontributions or xontribs, which are nothing more than a set of tools and conventions to extend the functionality of xonsh.
  3. It offers a robust interface in terms of history management, since it creates history files with a rich structure and metadata and an API to interact with them.
  4. It includes powerful prompt customization through tab completion, key bindings, and customizable color styles built in by default.

While, in this latest current version new features were included, such as:

  1. Addition of the union of the CTRL-Right keys to complete a single word of autosuggestion.
  2. Display of the type and description of environment variables upon completion.
  3. Improved pip/xpip completer.
  4. Addition of the CTRL-Backspace key to delete a single word via $XONSH_CTRL_BKSPC_DELETION.

For more information on "Xonsh" You can visit its official section at pypi y GitHub, or directly your section of Documentation y Tutorial, on its official website.

Screen shots

In our case, after installed with the command «sudo apt install xonsh» and the next «sudo pip3 install prompt_toolkit», we were able to start executing it and typing Bash and Python commands in only one Shell, as shown below:

Terminal Opening

Screenshot 1

Running the Xonsh Shell

Screenshot 2

Screenshot 3

Bash Command Examples

Xonsh: Screenshot 4

Xonsh: Screenshot 4

Python command examples

Xonsh: Screenshot 5

Finally, to explore more articles on Shell Scripting in FromLinux you can click the following link. And if you are curious to see the application that I am developing with pure bashI recommend you go to me YouTube channel and watch the videos about Linux Post Install – Automated Optimization Script (LPI-SOA).

Roundup: Banner post 2021

Your Order

In summary, "Xonsh" it's a great tool terminal software (CLI). What's more, it is extremely useful for those who love make scripts or practice Shell Scripting, not only about Bash but about Python, among others (Zsh, Fish, and Plumbum). Therefore, we hope that interesting tool continue to develop for the benefit of those who are passionate GNU / Linux users, and Terminal.

We hope that this publication is very useful for the entire «Comunidad de Software Libre, Código Abierto y GNU/Linux». And don't forget to comment on it below, and share it with others on your favorite websites, channels, groups or communities of social networks or messaging systems. Finally, visit our home page at «FromLinux» to explore more news, and join our official channel Telegram from DesdeLinux.

The content of the article adheres to our principles of editorial ethics. To report an error click here!.

Be the first to comment

Leave a Comment

Your email address will not be published.



  1. Responsible for the data: Miguel Ángel Gatón
  2. Purpose of the data: Control SPAM, comment management.
  3. Legitimation: Your consent
  4. Communication of the data: The data will not be communicated to third parties except by legal obligation.
  5. Data storage: Database hosted by Occentus Networks (EU)
  6. Rights: At any time you can limit, recover and delete your information.