Fish
Friendly Interactive Shell
User-friendly shell with syntax highlighting and autosuggestions out of the box
Overview
Fish (Friendly Interactive Shell) is a smart and user-friendly command line shell. It focuses on interactive use with features like syntax highlighting, autosuggestions, and tab completions that work out of the box without configuration.
Quick Facts
| Full Name | Friendly Interactive Shell |
| Category | Modern |
| POSIX Compliant | No |
| Config File | config.fish |
| Default On | None (manual install) |
| First Release | 2005 |
Who Should Use Fish?
- Beginners - User-friendly with sensible defaults
- Interactive users - Best-in-class autosuggestions
- Those who dislike configuration - Works great out of the box
- Visual learners - Syntax highlighting and web-based configuration
Installation
Install Fish shell.
# Install on macOS
brew install fish
# Install on Debian/Ubuntu
sudo apt install fish
# Install on Fedora
sudo dnf install fish
# Set as default shell
chsh -s $(which fish)
# Or run fish temporarily
fishBasic Usage
Fish syntax differs from POSIX shells.
# Variables (no export, no $)
set NAME "World"
echo "Hello, $NAME!"
# Lists (not arrays)
set fruits apple banana cherry
echo $fruits[1] # apple (1-indexed!)
# Conditionals
if test -f "file.txt"
echo "File exists"
end
# Loops
for i in (seq 1 5)
echo "Number: $i"
end
# Functions
function greet
echo "Hello, $argv[1]!"
endConfiguration
Fish configuration options.
# Configuration file: ~/.config/fish/config.fish
# Set environment variables
set -gx PATH $HOME/bin $PATH
# Abbreviations (better than aliases)
abbr -a gs git status
abbr -a ll ls -la
# Custom prompt function
function fish_prompt
echo (prompt_pwd) '> '
end
# Web-based configuration
fish_configKey Features
Autosuggestions
Suggests commands as you type based on history
Syntax Highlighting
Valid commands shown in color, errors in red
Web Configuration
Configure colors and prompt via web interface
No Configuration Needed
Excellent defaults out of the box
FAQ
Why is Fish not POSIX compatible?
Fish deliberately breaks from POSIX to provide a cleaner, more consistent syntax. This makes interactive use easier but means Bash scripts won't run directly in Fish.
Can I still run Bash scripts in Fish?
Yes! Bash scripts with proper shebang (#!/bin/bash) will run using Bash. Fish is your interactive shell, not the script interpreter.
Summary
Key takeaways for Fish:
- Best out-of-the-box experience with zero configuration
- Intelligent autosuggestions and syntax highlighting
- Clean, consistent syntax (not POSIX compatible)
- Web-based configuration interface
Official Documentation
For authoritative information, refer to the official documentation: