XONSH is a Python-powered shell


Xonsh is a Python-powered, cross-platform, Unix-gazing shell language and command prompt. The language is a superset of Python 3.5+ with additional shell primitives that you are used to from Bash and IPython. It works on all major systems including Linux, OSX, and Windows. Xonsh is meant for the daily use of experts and novices.

Install Documentation Github

What is Xonsh?

The xonsh shell has powerful language that used both for programming on Python and shell commands execution.

Xonsh is the Shell

The xonsh language has additional shell primitives that you are used to from Bash. Read more →

cd /home

cat /etc/passwd | grep root

ls -la

Xonsh is Python

The xonsh language is a superset of Python 3.5+ and you can run Python code and import modules. Read more →

2 + 2

import json
j = json.loads('{"Hello": "world!", "Answer": 42}')
print(j['Answer'])

Xonsh is the Shell in Python

With xonsh language you can write python code combining with the shell commands. Read more →

len($(curl -L https://xon.sh))

for filename in `.*`:
    print(filename)
    du -sh @(filename)

Xonsh is Python in the Shell

Prepare environment variables and arguments in Python and use it in the shell commands. Read more →

var = 'he' + 'llo'

echo @(var) > /tmp/@(var)

echo @(i for i in range(42))

Xonsh Features

Xonsh is a super-charged shell that enables you to work quickly and effectively! Some of the features that help set xonsh apart are:

Combine shell commands with Python or vice versa.

The language is a superset of Python 3.5+ with additional shell primitives that you are used to from Bash and IPython.

Xontribs - the 3rd-party extension system.

Xontributions, or xontribs, are a set of tools and conventions for extending the functionality of xonsh beyond what is provided by default.

Rich interface to discover history

The xonsh shell implements a collection of history files that have rich structure and API for discover them.

Powerful prompt customisation

Customisable tab completion, key bindings, color styles are on board by default.

Install Xonsh

Xonsh can be installed and run with various package managers, by using appimage, or from a docker container.

Install:

pip install xonsh
Learn more →

Install:

conda config --add channels conda-forge
conda install xonsh
Learn more →

AppImage is a format for distributing portable software on Linux without needing superuser permissions to install the application. The xonsh AppImage file contains both xonsh and Python and allows xonsh to be run on any AppImage-supported Linux distribution without installation or root access.

Download and run:

wget https://github.com/xonsh/xonsh/releases/latest/download/xonsh-x86_64.AppImage
chmod +x xonsh-x86_64.AppImage
./xonsh-x86_64.AppImage
Learn more →

Xonsh publishes a handful of containers, primarily targeting CI and automation use cases. All of them are published on Docker Hub.

Run the xonsh shell in the small size docker container:

docker run -it --rm xonsh/xonsh:slim

OSX brew:

brew install xonsh

Debian/Ubuntu apt:

apt install xonsh

Arch Linux pacman:

pacman -S xonsh

Fedore dnf:

dnf install xonsh

Xontribs

Xontributions, or xontribs, are a set of tools and conventions for extending the functionality of xonsh beyond what is provided by default.

pipeliner

Let your pipe lines from the standard output flow thru the Python code in the xonsh shell.

output-search

Get identifiers, paths, URLs and words from the previous command output and use them for the next command in the xonsh shell.

back2dir

Return to the most recently used directory when starting the xonsh shell.

argcomplete

Argcomplete support to tab completion of python and xonsh scripts in the xonsh shell.

Xonsh News

Most interesting publications around xonsh.

24 Oct, 2020

Xonsh Enrichment Proposal 2

New XEP-2 is waiting for review.

17 Oct, 2020

xonsh 0.9.24

Awesome features around prompt style and more xontribs in xonsh 0.9.24!

11 Jul, 2019

Xonsh on Scipy 2019 conference

A. Scopatz and G. Forsyth gave a two hour presentation of xonsh.