The Xonsh Shell — Python-powered shell
Description: The xonsh shell is a Python-powered, cross-platform, Unix-gazing shell language and command prompt.
Keywords: xonsh, xonsh shell, python shell, terminal, console, bash alternative, zsh alternative, fish alternative, devops tools, hacking tools

## 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.6+ 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 lets you easily mix Python and shell commands in a powerful and simplified approach to the command line.

### Xonsh is the Shell

The xonsh language has 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.6+ 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 you can combine Python with 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 them in 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.6+ 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.

#### Rich interface to discover history

The xonsh shell creates history files with rich structure and metadata and an API for interacting with 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.

##### PyPi package

Install:

    python -m pip install 'xonsh[full]'

Learn more →

##### Conda package

Install:

    conda config --add channels conda-forge
    conda install xonsh

Learn more →

##### Portable Linux AppImage

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 →

##### Docker container

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 a small size docker container:

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

##### Platform package managers: brew, apt, pacman, dnf

OSX brew:

    brew install xonsh

Debian/Ubuntu apt:

    apt install xonsh

Arch Linux pacman:

    pacman -S xonsh

Fedore dnf:

    dnf install xonsh

More installation methods →

## Xontribs

Xontributions, or xontribs, are a set of tools and conventions for extending the functionality of xonsh.

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.

More xontribs →

## Talks about xonsh

Some interesting publications around xonsh.

25 Aug, 2020

### Xonsh in TOP10 trending projects

We're listing down the top 10 trending open-source projects In Python on GitHub and the xonsh shell is one of these projects.

11 Jul, 2019

### Xonsh on Scipy 2019 conference

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

01 Jun, 2016

### Xonsh on PyCon 2016

The first big presentation of Xonsh from Anthony Scopatz!