LinuxCommandLibrary

fish

Friendly Interactive Shell

TLDR

Start an interactive shell session

$ fish
copy

Start an interactive shell session without loading startup configs
$ fish [[-N|--no-config]]
copy

Execute specific commands
$ fish [[-c|--command]] "[echo 'fish is executed']"
copy

Execute a specific script
$ fish [path/to/script.fish]
copy

Check a specific script for syntax errors
$ fish [[-N|--no-execute]] [path/to/script.fish]
copy

Execute specific commands from stdin
$ [echo "echo 'fish is executed'"] | fish
copy

Start an interactive shell session in private mode, where the shell does not access old history or save new history
$ fish [[-P|--private]]
copy

Define and export an environmental variable that persists across shell restarts (builtin)
$ set [[-U|--universal]] [[-x|--export]] [variable_name] [variable_value]
copy

SYNOPSIS

fish [options] [file ...]

PARAMETERS

-h, --help
    Display help and exit

-v, --version
    Display version information

-i, --interactive
    Force interactive mode, even if stdin not a tty

-l, --login
    Act as a login shell

-c command, --command command
    Run given command instead of interactive shell

--init-command command
    Evaluate specified command before startup

--config-path path
    Use specified config directory

--mode name
    Start fish in specified mode (default, sexpr)

--no-execute
    Parse but don't execute commands

--private
    Enable private mode (no history/config)

--on-event event command
    Register function on event

--debug[=N]
    Enable debug output (level 1-4)

DESCRIPTION

Fish (Friendly Interactive SHell) is a smart, user-friendly command line shell designed for Linux, macOS, and other Unix-like systems.

It emphasizes ease of use with features like out-of-the-box syntax highlighting, autosuggestions based on command history, and tab completions that are context-aware and intuitive.

Fish includes a web-based configuration tool (fish_config), powerful scripting capabilities, and avoids legacy POSIX shell pitfalls for better reliability. Unlike traditional shells like Bash, it prioritizes discoverability—no manual editing of config files required.

Ideal for beginners and power users, Fish scripts are readable and support advanced constructs like universal variables and event handlers.

CAVEATS

Fish is not POSIX-compliant, so scripts may need adaptation from Bash/Zsh. Config is not shared with other shells.

KEY FEATURES

Syntax highlighting, autosuggestions, web config, universal variables.
Invoke config with fish_config.

SCRIPTING

Uses C-like syntax with functions, no $() subshells; supports paths with spaces natively.

INSTALLATION

Available via package managers: apt install fish, brew install fish, or build from source.

HISTORY

Created by Axel Liljencrantz in 2005, Fish evolved from a hobby project to a popular alternative shell. Version 3.0 (2019) introduced major syntax improvements; current stable is 3.7.x (2024), with focus on performance and WebConfig enhancements.

SEE ALSO

bash(1), zsh(1), dash(1), tcsh(1)

Copied to clipboard