esc
Anthology / Yagnipedia / fish

fish

The Friendly Interactive Shell That Said No to POSIX and Yes to Colours
Technology · First observed 2005 (Axel Liljencrantz — a shell that decided the problem with Unix shells was Unix, and solved it by ignoring forty years of compatibility) · Severity: Divisive — either the best shell you've ever used or the shell that can't run your scripts

fish (Friendly Interactive SHell) is a Unix shell created by Axel Liljencrantz in 2005. It looked at forty years of shell syntax — the Bourne shell’s conventions, Bash’s extensions, POSIX’s requirements — and said: no.

No to $() for command substitution. Use (command).
No to export VAR=val. Use set -x VAR val.
No to [ condition ]. Use test condition.
No to && and || for chaining (originally). Use and and or.
No to POSIX compatibility. No to Bash compatibility. No to running any script from Stack Overflow without modification.

Yes to syntax highlighting. Yes to autosuggestions. Yes to discoverable tab completion. Yes to colours. Yes to being friendly.

“fish is the shell that treats you like a human instead of a PDP-11 operator. The cost is that you cannot paste Bash commands from the internet. For some people, this is a deal-breaker. For others, it is the point.”
The Caffeinated Squirrel, who tried fish for a week and went back to zsh because of one Bash one-liner

The Friendly Part

fish’s interactive experience is, objectively, the best of any shell. This is not controversial. Even people who don’t use fish admit that fish’s interactive features are superior:

Syntax highlighting — as you type, fish colours your command. Green means the command exists. Red means it doesn’t. You see the error before you press Enter. Every other shell lets you type the command wrong, press Enter, and then tells you it’s wrong. fish tells you while you’re still typing.

Autosuggestions — fish shows, in grey, the completion of your command based on history. Press the right arrow to accept. The suggestion appears instantly, drawn from your command history, so the more you use fish, the less you type. This feature is so good that zsh copied it (via zsh-autosuggestions plugin) and Bash copied it (via manual configuration that nobody does).

Tab completion — fish generates completions from man pages automatically. You don’t need to install a completion plugin for every tool. fish reads the man page and figures it out. The completions include descriptions. The completions are navigable with arrow keys. The completions work out of the box.

Configuration — fish has a web-based configuration tool. Type fish_config and a browser opens with a GUI for setting colours, prompts, and functions. This is either brilliant or an abomination, depending on whether you think a shell should have a web interface.

The Incompatible Part

fish is not POSIX-compatible. This is not a bug, not a limitation, not an oversight. This is a design choice. fish’s creators decided that POSIX shell syntax — the syntax of sh, Bash, and zsh — is the problem, and that solving the problem requires breaking compatibility.

This means:

For interactive use — typing commands, navigating the filesystem, running programs — this doesn’t matter. fish is an interactive shell. You type commands. The commands are the same programs. ls, grep, git, docker — they all work. The syntax for invoking them is slightly different, but the programs are the same.

For scripting — writing shell scripts, automating tasks, sharing one-liners — the incompatibility is a wall. A wall that fish built on purpose, that fish maintains on purpose, and that fish does not apologize for.

The Documentation

fish’s documentation is the best shell documentation ever written. This is not an exaggeration. The fish docs are clear, searchable, example-rich, and written for humans rather than for the POSIX committee.

This matters because good documentation is the only defence against incompatibility. If you’re going to break with forty years of convention, you need to explain the new convention clearly enough that users don’t reach for Bash out of frustration. fish’s documentation achieves this. Mostly.

Measured Characteristics

Year created:                            2005
Creator:                                 Axel Liljencrantz
POSIX compatible:                        no (on purpose)
Bash compatible:                         no (on purpose)
Syntax highlighting:                     yes (out of the box — green for valid, red for invalid)
Autosuggestions:                         yes (out of the box — from history)
Tab completion:                          yes (generated from man pages automatically)
Configuration:                           web-based GUI (fish_config)
Stack Overflow one-liners that work:     approximately 0%
Documentation quality:                   the best of any shell (genuinely)
Interactive experience:                  the best of any shell (genuinely)
Scripting portability:                   the worst of any shell (by design)
The trade-off:                           friendly + incompatible

See Also