fish — The Friendly Interactive Shell with Autosuggestions Built-In
fish is a command-line shell that prioritizes interactivity: autosuggestions from history, syntax highlighting as you type, smart tab completions generated from man pages, and sensible defaults — no configuration required.
先审查再安装
这个资产需要先审查。复制的指令会要求 Agent dry-run、列出写入项,确认后再继续。
npx -y tokrepo@latest install a5d85437-380a-11f1-9bc6-00163e2b0d79 --target codex先 dry-run,确认写入项后再运行此命令。
What it is
fish (Friendly Interactive Shell) is a command-line shell that prioritizes interactive usability. It provides autosuggestions from command history as you type, real-time syntax highlighting that colors invalid commands red, and tab completions auto-generated from man pages. Everything works immediately after installation with no configuration files to edit.
fish targets developers and system administrators who spend significant time in the terminal. It replaces bash or zsh as your daily interactive shell while keeping a clean scripting syntax with proper if/for/while blocks.
How it saves time or tokens
fish eliminates the need for shell plugin managers like Oh My Zsh. Autosuggestions mean you rarely type full commands twice. Tab completion reads actual man pages to offer relevant flags and options without memorization. The web-based configuration UI (fish_config) lets you customize colors and prompts without editing dotfiles. Universal variables persist across all terminal sessions automatically.
How to use
- Install fish via your package manager:
brew install fishon macOS orsudo apt install fishon Ubuntu/Debian. - Run
fishto start an interactive session, or set it as your default shell withchsh -s /opt/homebrew/bin/fish. - Start typing commands and accept autosuggestions with the right arrow key. Use Tab for completions.
Example
# Install on macOS
brew install fish
# Set as default shell
echo /opt/homebrew/bin/fish | sudo tee -a /etc/shells
chsh -s /opt/homebrew/bin/fish
# fish features in action:
# Type 'git com' -> autosuggests 'git commit -m' from history
# Type 'curl --' -> Tab shows all curl flags from man page
# Type 'nonexistent-cmd' -> highlighted red (command not found)
# Web-based config
fish_config
Related on TokRepo
- Automation Tools — CLI and automation tools for developer workflows
- Coding AI Tools — Developer productivity tools
Common pitfalls
- fish is not POSIX-compatible by design. Bash scripts with
[[ ]]or$()syntax needbash -cto run. This is a deliberate tradeoff for cleaner interactive syntax. - Setting fish as your login shell can break system scripts that expect POSIX sh. Some users prefer launching fish from their .bashrc instead of changing the login shell.
- fish abbreviations (abbr) are different from aliases. Abbreviations expand visually as you type, while aliases are simple function wrappers. Use abbreviations for frequently typed commands.
常见问题
No. fish uses its own syntax that is not POSIX-compatible. Bash scripts should be run with `bash script.sh` or `#!/bin/bash` shebangs. fish is designed as an interactive shell, not a scripting replacement for bash.
fish suggests commands from your command history as you type. The suggestion appears as gray text after your cursor. Press the right arrow key to accept the full suggestion, or Alt+right to accept one word at a time.
No. fish has its own plugin ecosystem. Fisher and Oh My Fish are the popular plugin managers. Many zsh plugin equivalents exist for fish, including git abbreviations, directory jumping, and prompt themes.
fish generates completions automatically from man pages without configuration. zsh requires manual completion setup or plugins. fish completions also show descriptions alongside each option, making flag discovery faster.
Yes. fish works in any terminal emulator and with tmux, screen, and similar tools. The syntax highlighting and autosuggestions function identically in multiplexed sessions.
引用来源 (3)
- fish GitHub— fish provides autosuggestions, syntax highlighting, and tab completions from man…
- fish Documentation— fish shell interactive features and scripting syntax
- fish Official Site— Command-line shell comparison and interactive features
讨论
相关资产
IPython — The Interactive Computing Shell for Python
IPython provides a rich interactive Python shell with tab completion, syntax highlighting, magic commands, and deep integration with the scientific Python stack.
zsh-autosuggestions — Fish-Like Autosuggestions for Zsh
A Zsh plugin that suggests commands as you type based on history and completions, accepting suggestions with a single keystroke.
fish-ai — Fish Shell AI Shortcuts (Plugin)
fish-ai adds LLM shortcuts to the Fish shell: comment↔command, typo fixing, and autocomplete via hotkeys; install it with `fisher install`.
Tone.js — Web Audio Framework for Interactive Music
A TypeScript framework built on the Web Audio API that provides scheduling, synthesis, and effects for creating interactive music in the browser.