3.3 KiB
| title | aliases | tags | sources | created | updated | |||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Fish Shell 4.6 — Introduction & Setup |
|
|
|
2026-04-17 | 2026-04-17 |
What is Fish?
Fish (friendly interactive shell) is a shell focused on usability and interactive use. It works out-of-the-box without configuration.
Headline features:
- Syntax highlighting, autosuggestions, tab completion with navigable/filterable lists
- No config required — ready immediately after install
- Easy scripting with a clean, learnable syntax
Starting & Exiting
fish # start a fish session inside another shell
exit # end the session
Making Fish Your Default Shell
Option A — terminal emulator setting (safest): point your terminal (WezTerm, Kitty, iTerm2) to /usr/local/bin/fish directly in its config.
Option B — login shell (riskier, see warning below):
command -v fish | sudo tee -a /etc/shells # register fish
chsh -s "$(command -v fish)" # set as login shell
[!warning] Login shell caveat Some Linux distros require the login shell to be Bourne-compatible and source
/etc/profile. Fish is not Bourne-compatible — this can break PATH and other env vars. Prefer the terminal emulator approach on Linux.
Configuration Files
| File | Purpose |
|---|---|
~/.config/fish/config.fish |
Main config — runs every shell startup |
~/.config/fish/conf.d/*.fish |
Auto-sourced before config.fish |
Use guards to scope behavior:
if status --is-interactive
# interactive-only setup (prompt, aliases, etc.)
end
if status --is-login
set -gx PATH $PATH ~/linux/bin
end
Prefer fish_add_path over manual PATH manipulation — it deduplicates automatically:
fish_add_path ~/linux/bin
Shebang Line for Fish Scripts
#!/usr/bin/env fish
echo Hello from fish $version
Use env fish (not a hardcoded path) so the script works regardless of where fish is installed. The shebang is only needed when executing a script directly — not when running with fish /path/to/script.
Exit Event Handler
function on_exit --on-event fish_exit
echo fish is now exiting
end
Inspecting Your Config Changes
fish_delta # shows what you changed from fish's defaults
Key Takeaways
- Fish is batteries-included: syntax highlighting, autosuggestions, and completions work with zero config
- Don't set fish as login shell on Linux unless you know your distro supports it — use terminal emulator config instead
- Config lives in
~/.config/fish/config.fish; modular snippets go inconf.d/ - Use
fish_add_pathinstead of manually editing$PATH - Script shebangs should use
#!/usr/bin/env fishfor portability fish_deltareveals your customizations vs defaults
Related
- wiki/dotfiles/linux-terminal-ricing — Kitty + Fish + Tide full setup guide
- wiki/dotfiles/terminal-cheatsheet — daily stack reference with fish/zsh
- wiki/dotfiles/wezterm-config — set fish as the default program in WezTerm
Sources
raw/Introduction — fish-shell 4.6.0 documentation.md(fishshell.com/docs/current/index.html)