Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Why hash

hash is a POSIX shell written from scratch in C, in one binary that needs nothing but libc. It runs the scripts you already have, and it brings the things people install plugins for into the shell itself: syntax highlighting as you type, autosuggestions from your history, a prompt that knows about git, suggestions when a command name is misspelt, and completion that understands cd, git, make and man.

hash demo

It runs POSIX scripts

184 of 186 smoosh POSIX tests pass, 1 skipped on purpose (why), 1 failing. CI measured this on commit f085908 on 2026-11-11 (the run).

smoosh is a test suite for POSIX shells built from the standard and from bugs reported on the shells’ mailing lists; it is what hash is measured against on every push, and the figure above is rewritten from the latest run each time the site is published. Bugs it has caught, from arithmetic on special parameters to the exit status of an EXIT trap, are fixed in the shell, not worked around in the tests. A test that still fails stays in the count and gets an issue under the posix label; the one skipped test is skipped for a documented reason, linked above.

A second suite, modernish, runs every week; the shell bugs it still finds are tracked openly.

What is built in

hashbashdashzshfish
Runs POSIX sh scriptsyesyesyesin sh emulationno
Syntax highlighting as you typebuilt innonopluginbuilt in
Autosuggestions from historybuilt innonopluginbuilt in
Git branch and status in the promptbuilt in, with presetsscriptsnovcs_info or pluginbuilt in
“Did you mean” for a misspelt commandbuilt inhandler scriptnosetopt correctbuilt in
Completion for git, make, man, variablesbuilt inbash-completion packagenocompsysbuilt in
Programmable completioncomplete -W, -Fcompletenocompsyscomplete
Vi editing modeyesyesnoyesyes
Dependencies beyond libcnonereadline, ncursesnonencursesseveral

“plugin”, “package”, “handler” and “scripts” mean the shell can get the feature from something you add. hash ships it. The other shells are described as they are installed by their packages; some are more capable in other ways, and dash is smaller.

Size

The macOS Apple Silicon binary of the latest release is 261 KB; the static Linux x86_64 binary, with libc inside it, is 1.4 MB (release assets). It starts in a few milliseconds and reads no configuration beyond ~/.hashrc.

How it is tested

Every push runs, on GitHub Actions, where you can read the results:

  • the unit tests, the integration script and a pseudo-terminal harness that types at a real prompt, on Linux, macOS and FreeBSD, with gcc and clang (Tests);
  • the 186 smoosh conformance tests (POSIX Compliance);
  • AddressSanitizer, UndefinedBehaviorSanitizer, ThreadSanitizer, MemorySanitizer and Valgrind over the tests, and AFL++ fuzzing of the tokenizer, the parser, variable expansion and the string helpers (Sanitizers & Fuzzing).

Only the latest release is supported, and a security fix ships as a new release (security policy).

Try it

brew install juliojimenez/hash/hash-shell      # macOS
sudo apt install hash-shell                     # Debian and Ubuntu, after adding the repository
docker run -it juliojimenez/hash-shell          # anywhere with Docker

The installation pages have the APT repository line, the FreeBSD binaries and the build from source. Nothing changes until you make it your login shell; hash-shell runs it as a command like any other.