What is Fish Shell & How to Install It in Termux (2026 Complete Guide)
- Introduction — Why Fish Shell Matters
- What is Fish Shell? A Deep Dive
- Fish Shell vs Bash vs Zsh — Key Differences
- How to Install Fish Shell in Termux
- Configuring and Customizing Fish Shell
- Essential Fish Shell Commands and Features
- Common Errors and Fixes
- Pro Tips for Fish Shell in Termux
- Comparison Table — Bash vs Zsh vs Fish
- FAQ
- Conclusion
// 00 — Introduction: Why Fish Shell Matters in Termux
If you have been using Termux for a while, you already know that the default shell is bash. It works, it gets the job done, and millions of Linux users rely on it every single day. But once you spend some time with Fish shell — the Friendly Interactive SHell — going back to bash feels like switching from a smartphone back to a feature phone. Fish shell in Termux transforms your entire command-line experience on Android into something smarter, faster, and a whole lot more enjoyable to use.
Fish shell was designed from the ground up with one core philosophy: be helpful out of the box. Unlike bash or even zsh, Fish does not require you to spend hours tweaking configuration files, installing plugins, or memorizing cryptic syntax before it starts feeling useful. The moment you launch it, you get syntax highlighting, autosuggestions, tab completions, and a clean prompt — all working immediately, with zero configuration.
For Android users running Termux, this is a game-changer. Whether you are a student learning Linux for the first time, a developer who wants a productive terminal on your phone, or a cybersecurity enthusiast exploring ethical hacking tools, Fish shell makes your workflow noticeably smoother. Commands are color-coded so you instantly know if what you typed is valid. When you start typing a command you used before, Fish suggests the rest of it in grey text — just press the right arrow key to accept it. These small quality-of-life improvements add up to a dramatically better terminal experience.
In this guide, written by Rixon Xavier, you will learn everything you need to know about Fish shell — what it is, how it compares to bash and zsh, how to install it in Termux on your Android device without root, how to configure it, and how to get the most out of its powerful features. By the time you finish reading, you will have Fish shell running beautifully on your phone and a solid understanding of why so many Linux power users have made it their default shell. Let us get started.
// 01 — What is Fish Shell? A Deep Dive
The Origins of Fish Shell
Fish shell, which stands for Friendly Interactive SHell, is a Unix shell first released in 2005 by Axel Liljencrantz. The project was born out of frustration with the steep learning curve and inconsistent behavior of traditional shells like bash and csh. The core idea was radical for its time: what if a shell was designed to be genuinely user-friendly without sacrificing power?
Over the years, Fish shell has grown into a mature, actively maintained open-source project. Its GitHub repository has thousands of stars, and a passionate community contributes plugins, themes, and improvements constantly. Fish is written in C++ and is known for being lightweight, fast to start up, and remarkably stable even in constrained environments — which is exactly why it works so well inside Termux on Android.
What Makes Fish Shell "Friendly"?
The word "friendly" in Fish's name is not just marketing. It describes a genuinely different design philosophy compared to older shells. Here is what sets Fish shell apart:
Syntax Highlighting in Real Time: As you type a command in Fish shell, the text changes color instantly. Valid commands appear in one color, invalid commands in another (usually red), and arguments and flags are highlighted separately. This means you catch typos before you even press Enter. This single feature alone prevents countless frustrating "command not found" errors, especially for beginners still learning their way around the terminal.
Autosuggestions Based on History: Fish shell watches the commands you run and learns from them. As you start typing, it suggests the most likely completion in light grey text, pulled from your command history. To accept the suggestion, just press the right arrow key. This is not the same as tab completion — it is predictive, history-aware, and feels almost like the shell is reading your mind.
Powerful Tab Completion Out of the Box: Fish ships with completions for hundreds of common commands. Press Tab after a command and Fish does not just show filenames — it shows subcommands, flags, option descriptions, and even man page summaries. This means you can explore what a command does without ever leaving the terminal.
Web-Based Configuration: Fish includes a built-in web interface for configuration. Run the command fish_config and Fish opens a browser page where you can set your prompt theme, colors, abbreviations, and more — all with a visual interface. This is completely unique among shells and makes customization accessible even to people who do not enjoy editing config files.
Sane Scripting Syntax: If you have ever tried to write a bash script and been confused by the syntax for variables, loops, or conditionals, Fish offers a cleaner, more consistent scripting language. Variables use the set command. Conditions are more readable. The overall language is more like modern programming languages than the archaic syntax inherited by bash from the 1970s.
Fish Shell on Android with Termux
Termux is a terminal emulator and Linux environment for Android that lets you run a real Linux shell on your phone without rooting it. Termux uses its own package manager (pkg) built on top of APT, and its package repository includes Fish shell. This means installing Fish in Termux is as simple as running a single command — and the experience is just as good as on a desktop Linux system.
// 02 — Fish Shell vs Bash vs Zsh: Key Differences
Understanding the Shell Landscape
Before you commit to Fish shell, it is worth understanding where it sits in the broader ecosystem of Unix shells. The three shells you are most likely to encounter as a Termux user are bash, zsh, and fish. Each has a different philosophy and a different set of strengths.
Bash (Bourne Again SHell) is the default shell on most Linux distributions and in Termux. It has been around since 1989 and is extraordinarily well-documented. Nearly every script you find online is written in bash. Its syntax is powerful but quirky — things like variable expansion, arrays, and string manipulation can feel inconsistent. Bash is also quite bare-bones by default; to get autosuggestions or syntax highlighting, you need to install additional tools and configure them manually.
Zsh (Z Shell) is bash's more feature-rich sibling. It is the default shell on macOS and has a huge ecosystem of plugins and themes, most famously through the Oh My Zsh framework. Zsh is largely compatible with bash scripts, which makes it easy to switch to. However, it requires significant configuration to unlock its best features, and Oh My Zsh can noticeably slow down shell startup time if you load too many plugins.
Fish shell takes a different approach entirely. It prioritizes user experience over backward compatibility. Fish is not POSIX-compliant by design — its scripting syntax deliberately breaks from traditional shell conventions to be cleaner and more consistent. This means bash scripts do not run natively in Fish (you still run them with bash script.sh), but Fish's own scripting language is significantly easier to write and read.
Interactive Use vs Scripting
This distinction is important: Fish shell is primarily designed for interactive use — the day-to-day experience of typing commands in a terminal. For writing scripts that will be shared or run in other environments, bash remains the standard. Many Fish users keep Fish as their interactive shell while still writing scripts with the #!/bin/bash shebang line. This is a perfectly normal and recommended workflow.
In Termux on Android, where you are mostly running commands interactively rather than writing complex scripts, Fish shell genuinely shines. You get a dramatically better typing experience, and the lack of POSIX compliance rarely matters in day-to-day use.
Performance Comparison
On Android hardware, shell startup time matters. Fish shell starts up quickly — typically in well under 100 milliseconds on modern Android devices. Bash is similarly fast. Zsh with a heavy plugin framework like Oh My Zsh can take half a second or more to start, which feels sluggish on older or mid-range phones. For Termux users, Fish strikes an excellent balance between features and performance.
// 03 — How to Install Fish Shell in Termux (Step-by-Step)
Prerequisites
Before you install Fish shell, make sure your Termux installation is up to date. This prevents dependency conflicts and ensures you get the latest version of Fish. You should also have a working internet connection, as the installation downloads packages from Termux's repositories.
Open Termux and Update Your Packages
Start by launching Termux on your Android device. Once the terminal is open, run the following command to update all installed packages to their latest versions:
pkg update && pkg upgrade -y
This command first refreshes the package lists from Termux's servers, then upgrades any outdated packages. The -y flag automatically confirms any prompts so you do not have to type "yes" multiple times. This step may take a few minutes depending on your internet speed and how many packages need updating.
Install Fish Shell Using pkg
Now install Fish shell using Termux's package manager. This is a single, straightforward command:
pkg install fish -y
Termux will download and install Fish shell along with any required dependencies. You will see a stream of output as packages are fetched and unpacked. The whole process usually takes less than a minute on a decent connection. Once it completes and you see the command prompt again, Fish shell is installed and ready to use.
Verify the Installation
Confirm that Fish shell was installed correctly by checking its version:
fish --version
You should see output similar to this:
fish, version 3.7.1
The exact version number may differ depending on when you install, but as long as you see a version number, the installation was successful.
Launch Fish Shell
To start using Fish shell right now, simply type its name and press Enter:
fish
Your prompt will change immediately. You are now inside Fish shell. Notice how the prompt looks different from bash — it typically shows your username, hostname, and current directory in a clean, colorful format. Try typing a command like ls and watch how the text is highlighted in real time as you type.
Set Fish Shell as Your Default Shell in Termux
If you want Fish to launch automatically every time you open Termux instead of bash, you need to set it as your default shell. In Termux, the standard chsh command works differently than on a regular Linux system. The correct way to change your default shell in Termux is:
chsh -s fish
After running this command, close Termux completely and reopen it. Fish shell should now be your default shell. You will know it worked if your prompt looks like the Fish prompt rather than the standard bash prompt.
chsh -s bash. You can also type bash at any Fish prompt to temporarily switch back.Alternative: Launch Fish Automatically via .bashrc
Some users prefer a slightly different approach: keep bash as the login shell but have it automatically start Fish. This gives you a fallback in case of issues. To do this, add the following lines to your ~/.bashrc file:
# Auto-launch Fish shell
if command -v fish &> /dev/null; then
exec fish
fi
Open your .bashrc file with nano ~/.bashrc, paste these lines at the bottom, then save with Ctrl+X, Y, Enter. The next time you open Termux, bash will start and immediately hand off control to Fish shell. The exec command replaces the bash process with Fish, so there is no performance overhead from running two shells.
// 04 — Configuring and Customizing Fish Shell
Fish Shell Configuration File Location
Fish shell stores its configuration in a different location than bash. Instead of ~/.bashrc, Fish uses a directory structure under ~/.config/fish/. The main configuration file is:
~/.config/fish/config.fish
This file is the equivalent of .bashrc for Fish. If it does not exist yet, you can create it. Any commands or settings you put here will run every time Fish starts. To open or create this file, run:
mkdir -p ~/.config/fish
nano ~/.config/fish/config.fish
Setting Environment Variables in Fish
In bash, you set environment variables with export VAR=value. Fish uses a different but cleaner syntax:
# Set a variable for the current session
set MY_VAR "hello world"
# Set a universal variable (persists across sessions)
set -Ux MY_VAR "hello world"
# Export a variable so child processes can see it
set -x PATH $PATH $HOME/.local/bin
The -U flag makes a variable "universal" — it persists across all Fish sessions and survives reboots without needing to be in config.fish. The -x flag exports the variable to the environment, similar to bash's export.
Creating Aliases and Abbreviations
Fish has two ways to create shortcuts for commands: aliases and abbreviations. Abbreviations are unique to Fish and are generally preferred because they expand visibly in the command line, so you always see exactly what command will run.
# Create a persistent abbreviation (recommended)
abbr --add ll 'ls -la'
abbr --add gs 'git status'
abbr --add cls 'clear'
abbr --add update 'pkg update && pkg upgrade -y'
# Create a traditional alias
alias grep='grep --color=auto'
When you type ll and press Space or Enter, Fish expands it to ls -la right in the command line. This is incredibly helpful for learning because you always see the full command rather than having it hidden behind an alias.
Customizing Your Fish Prompt
The Fish prompt is defined by a function called fish_prompt. You can customize it by editing this function in your config. But the easiest way is to use Fisher (the Fish plugin manager) to install a theme, or to use the built-in web configuration interface:
# Launch the web-based configuration UI
fish_config
Note that in Termux, fish_config may not launch a browser automatically since you are on Android. However, it will print a URL you can open in your Android browser to access the configuration interface. This gives you access to a visual prompt editor and color scheme selector.
Installing Fisher — The Fish Plugin Manager
Fisher is the most popular plugin manager for Fish shell. It lets you install themes, prompts, and utilities with a single command. To install Fisher in Termux:
curl -sL https://raw.githubusercontent.com/jorgebucaran/fisher/main/functions/fisher.fish | source && fisher install jorgebucaran/fisher
Once Fisher is installed, you can install popular themes like Tide or plugins like nvm.fish:
# Install the Tide prompt theme (highly recommended)
fisher install IlanCosman/tide@v6
# Install z (directory jumping)
fisher install jethrokuan/z
// 05 — Essential Fish Shell Commands and Features
Autosuggestions — Your Most Used Feature
Fish shell's autosuggestion system is its most beloved feature. As you type, Fish shows a greyed-out suggestion based on your history. Interact with it using these key bindings:
# Accept the full autosuggestion
→ (Right Arrow)
# Accept just the next word of the suggestion
Alt + →
# Cycle through history suggestions
↑ / ↓ (Up/Down Arrow)
# Search history interactively
Ctrl + R
Fish Shell Variables and Loops
Fish scripting syntax is clean and readable. Here are the most common patterns you will use:
# Set a variable
set name "Termux User"
echo "Hello, $name"
# For loop
for i in 1 2 3 4 5
echo "Number: $i"
end
# Loop over files
for file in *.txt
echo "Found: $file"
end
# While loop
set count 0
while test $count -lt 5
set count (math $count + 1)
echo "Count: $count"
end
# If-else condition
if test -f ~/.config/fish/config.fish
echo "Config file exists!"
else
echo "No config file found."
end
Fish Functions
Functions in Fish are first-class citizens and extremely easy to write. Unlike bash functions, Fish functions are stored in individual files under ~/.config/fish/functions/ and are auto-loaded when called:
# Define a function inline
function greet
echo "Hello, $argv! Welcome to Fish shell."
end
# Call it
greet "Rixon"
# Save a function permanently
funcsave greet
The funcsave command automatically saves the function to the correct location in ~/.config/fish/functions/, so it is available in every Fish session. This is much more organized than dumping everything into a single .bashrc file.
Useful Built-in Fish Commands
# View and edit command history
history
# Search history for a pattern
history search pkg
# Delete a specific history entry
history delete --prefix "bad command"
# List all defined functions
functions
# View the source of a function
functions greet
# List all abbreviations
abbr
# Check Fish syntax without running
fish --no-execute script.fish
# Measure command execution time
time ls -la
Using Fish with Common Termux Tools
Fish shell works seamlessly with all the tools you already use in Termux. Here are some practical combinations that demonstrate Fish's power for Termux users interested in Linux and cybersecurity education:
# Quick abbreviations for common Termux workflows
abbr --add nmap 'nmap -v'
abbr --add py 'python3'
abbr --add pip 'pip3'
abbr --add g 'git'
abbr --add gp 'git push'
abbr --add gc 'git commit -m'
# Function to update everything in one command
function update_all
echo "==> Updating Termux packages..."
pkg update && pkg upgrade -y
echo "==> Updating pip packages..."
pip3 list --outdated --format=freeze | grep -v '^\-e' | cut -d = -f 1 | xargs -n1 pip3 install -U 2>/dev/null
echo "==> All done!"
end
funcsave update_all
// 06 — Common Errors and Fixes
Error: "fish: Unknown command"
This happens when you try to run a bash-style command in Fish that uses syntax Fish does not understand. For example, export VAR=value or source ~/.bashrc will fail in Fish.
# WRONG (bash syntax in Fish)
export MY_VAR="hello"
# CORRECT (Fish syntax)
set -x MY_VAR "hello"
# To source a bash file from Fish
bash -c "source ~/.bashrc && env" | while read line; set -x (echo $line | cut -d= -f1) (echo $line | cut -d= -f2-); end
Error: "chsh: PAM authentication failed" When Setting Default Shell
In some Termux environments, chsh -s fish may require a password or may fail. If this happens, use the alternative .bashrc method described in Section 3 to auto-launch Fish from bash instead.
Fish Shell Not Found After Installation
If you type fish and get "command not found", the installation may not have completed correctly. Try reinstalling:
pkg uninstall fish -y
pkg install fish -y
which fish
The which fish command should output the path to the Fish binary, typically /data/data/com.termux/files/usr/bin/fish.
Autosuggestions Not Appearing
If autosuggestions are not showing up, it is likely because Fish does not have enough history to make suggestions. Run a few commands and then try again. Autosuggestions become smarter as your history grows. You can also check that the fish_user_key_bindings function is set up correctly if you have made manual key binding changes.
Colors Not Displaying Correctly
If Fish's syntax highlighting looks wrong or colors are missing, your terminal emulator may not support 256 colors. In Termux's built-in terminal, colors work perfectly. If you are using a third-party terminal app, make sure it has color support enabled. You can also try:
set -Ux TERM xterm-256color
Fisher Install Fails — curl Not Available
If curl is not installed in your Termux, Fisher installation will fail. Fix it with:
pkg install curl -y
// 07 — Pro Tips for Fish Shell in Termux
fish_add_path ~/my/directory. This uses a universal variable that persists automatically.funced function_name. This opens the function in your default editor, and Fish automatically reloads it when you save.ls *.txt and press Tab, Fish will expand and preview the matching files before you press Enter. This prevents accidentally deleting or modifying the wrong files.bind \cg 'git status' runs git status whenever you press Ctrl+G.math command that does arithmetic directly in the terminal: math 15 * 24 or math "sin(45)". Useful for quick calculations while working.#!/bin/bash or #!/bin/sh at the top, not Fish. This keeps them portable. Use Fish only for your interactive shell experience.// 08 — Comparison Table: Bash vs Zsh vs Fish Shell
| Feature | Bash | Zsh | Fish Shell |
|---|---|---|---|
| Default in Termux | ✅ Yes | ❌ No | ❌ No |
| POSIX Compliant | ✅ Yes | ✅ Yes | ❌ No (by design) |
| Syntax Highlighting | ❌ Plugin needed | ❌ Plugin needed | ✅ Built-in |
| Autosuggestions | ❌ Plugin needed | ❌ Plugin needed | ✅ Built-in |
| Smart Tab Completion | ⚠️ Basic | ✅ With plugins | ✅ Built-in |
| Startup Speed | ✅ Fast | ⚠️ Slow with plugins | ✅ Fast |
| Beginner Friendly | ⚠️ Moderate | ⚠️ Moderate | ✅ Very easy |
| Plugin Ecosystem | ⚠️ Limited | ✅ Huge (Oh My Zsh) | ✅ Good (Fisher) |
| Web Config Interface | ❌ No | ❌ No | ✅ Yes (fish_config) |
| Script Compatibility | ✅ Universal | ✅ High | ⚠️ Own syntax |
| Best For | Scripting, servers | Power users | Interactive use, beginners |
// FAQ — Fish Shell in Termux
pkg install fish. There are no paid tiers, subscriptions, or premium features — everything is free.bash myscript.sh. This is the standard workflow — use Fish for interactive terminal use and bash for writing scripts.bash and press Enter to switch to bash temporarily. To change your default shell back to bash permanently, run chsh -s bash from either bash or Fish, then restart Termux.fish_add_path /path/to/directory — this permanently adds the directory to Fish's PATH using a universal variable. Alternatively, add set -x PATH $PATH /path/to/directory to your ~/.config/fish/config.fish file.fisher install IlanCosman/tide@v6) is widely considered the best Fish prompt theme. It is fast, informative, and highly customizable. For a simpler option, Fish's default prompt is already clean and functional. Since Termux uses a small screen on Android, a minimal prompt often works best.// 09 — Conclusion: Upgrade Your Termux Experience with Fish Shell
Fish shell is one of the best upgrades you can make to your Termux setup, and after reading this guide, you now have everything you need to make the switch. We covered what Fish shell is and why it was designed to be beginner-friendly, how it compares to bash and zsh, the complete step-by-step installation process in Termux, configuration and customization options including Fisher and custom themes, essential commands and scripting syntax, common errors and how to fix them, and pro tips to get the most out of your Fish shell experience.
The bottom line is this: if you spend any meaningful amount of time in Termux, Fish shell will make that time more productive and more enjoyable. The built-in syntax highlighting, intelligent autosuggestions, and powerful tab completion work out of the box without any configuration. You will catch errors before running commands, navigate your history faster, and discover command options you did not even know existed.
Fish shell works beautifully on Android with no root required, installs in seconds, and is backed by an active open-source community. Whether you are using Termux for learning Linux, practicing ethical cybersecurity concepts, coding on the go, or just exploring what your Android device is capable of, Fish shell makes the experience significantly better.
pkg install fish -y, then type fish to enter your new shell. You will notice the difference immediately.If you found this guide helpful, bookmark this page for future reference and share it with friends who use Termux. Have questions or ran into an issue not covered here? Drop a comment below — the Hydra Termux community is here to help. And stay tuned for more in-depth Termux tutorials covering Linux tools, cybersecurity concepts, and Android productivity. Happy hacking — the educational kind!
Comments
Post a Comment