Skip to content

Xonsh

Python-powered shell. Full-featured, cross-platform and AI-friendly.

Install

$git clone https://github.com/xonsh/xonsh

Install command taken from the project's README or registry entry. Always review code before running it.

Xonsh

.. raw:: html

Xonsh (sounds like "consh") is a full-featured and cross-platform Python-based shell. The language is a superset of Python 3 with seamless integration of shell functionality and commands. It works on all major platforms, including Linux, macOS, Windows, BSD, Jupyter, Android, Raspberry Pi and Nix.

.. raw:: html

.. list-table:: :widths: 1 1

    • Xonsh is the Shell
    • Xonsh is Python
    • .. code-block:: shell

      cd $HOME

      id $(whoami) > ~/id.txt

      cat /etc/passwd | grep root

      $PROMPT = '@ '

    • .. code-block:: python

      2 + 2

      var = "hello".upper()

      @.imp.json.loads('{"a":1}')

      [i for i in range(0,10)]

    • Xonsh is the Shell in Python
    • Xonsh is Python in the Shell
    • .. code-block:: python

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

      $PATH.append('/tmp')

      p'/etc/passwd'.read_text().find('usr')

      $(@json podman ps --format json)['ID']

    • .. code-block:: python

      name = 'snail' echo @(name) > /tmp/@(name)

      with p'/tmp/dir'.mkdir().cd(): touch @(input('File: '))

      aliases['e'] = 'echo @(2+2)' aliases['a'] = lambda args: print(args)

    • Xonsh is Everywhere
    • Xonsh is an Ecosystem
    • .. code-block:: python

      $PATH

      ['/bin', '/sbin'] # Linux

      ['/homebrew/bin'] # macOS

      ['/usr/local/bin'] # FreeBSD

      ['/mnt/c/Windows/System32'] # WSL

      [r'c:\Windows\System32'] # Windows

      ['/nix/store/0-python/bin'] # Nix

      ['/data/termux/usr/bin'] # Termux

      ['/tmp/.mount_x/usr/bin/'] # AppImage

      ['/app/bin'] # Flatpak

      $PATH = ['/my/own/path']

    • .. code-block:: python

      xontrib load term_integration
      prompt_starship
      powerline
      dracula
      chatgpt
      django
      jupyter
      1password
      github_copilot
      history_encrypt

    • Xonsh is a Meta-Shell
    • Xonsh is User-extensible
    • .. code-block:: python

      xontrib load sh
      fish_completer

      osqueryi ! SELECT platform FROM os_version

      def nudf(cmd): return @.imp.pandas.DataFrame( $(@json nu -c @(cmd+'| to json'))) nudf!(ls -la)

      aliases['ai'] = 'ollama run llama3' ai! how to remove images in podman

    • .. code-block:: python

      @events.on_ptk_create def custom_keybindings(bindings, **kw): @bindings.add(Keys.ControlI) def say_whoami(event): echo $(whoami)

      @events.on_postcommand def _prompt_err_cmd(cmd, rtn, out, ts): if rtn != 0: $XONSH_PROMPT_NEXT_CMD = cmd.rstrip()

If you like xonsh, :star: the repo and spread the word about xonsh.

.. class:: center

Similar plugs

Orca is the ADE for working with a fleet of parallel agents. Run any coding agent with your own subscription. Available on desktop, mobile and remote runtime.

Multi-harness agentic plugin marketplace for Claude Code, Codex, Cursor, OpenCode, GitHub Copilot, Google Antigravity, and Pi

Open source Ghostty-based macOS terminal with vertical tabs and notifications for AI coding agents. Built for multitasking, organization, and programmability.

The Developer Tool for Visual Engineers • An Open-Source AI-First Design tool • Visually build, style, and edit your code with AI • World's best, top-most agent recommended #1…

A powerful GUI app and Toolkit for Claude Code - Create custom agents, manage interactive Claude Code sessions, run secure background agents, and more.

Explore related