Cookbook.fish
From Shell to Plate: Savor the Zest of Fish 🦞
Install / Use
/learn @jorgebucaran/Cookbook.fishREADME
The Fish Cookbook
From Shell to Plate: Savor the Zest of Fish 🦞
Welcome to The Fish Cookbook, your ultimate guide to unlocking the full potential of shell scripting with the delightful Fish. With its user-friendliness and convenient features, Fish stands out as a true gem among shells.
Master programming challenges with our curated collection of Fish recipes. Glide through your code with ease, whether you're a seasoned pro or a shell scripting newbie.
This cookbook is licensed under CC BY-NC-SA 4.0, ensuring knowledge and inspiration flow while respecting the rights of others.
What's on the Menu?
- Setting Sail
- Foundations
- Decoding Prompts: What Are These Wiggly Characters?
- Where Am I in Fish? Discovering Your Current Path
- Searching and Running Commands in Fish: How Do I Do That?
- Did My Command Succeed in Fish?
- What's the Fish Shebang All About? Making Scripts Executable
- How Do I Debug My Fish Scripts Interactively? Navigating with Breakpoints
- Where to find Fish's equivalent of
.bash_profileor.bashrc?
- All About Variables
- How Do I Set Variables in Fish? A Quick Guide to Variable Scopes
- How Do I Export a Variable in Fish?
- How Do I List All Environment Variables in Fish?
- How Do I Set the
$PATHPersistently in Fish? - How Do I Remove a Path from the
$PATHin Fish? - How Do I Remove a Path Persistently from the
$PATHin Fish? - How Do I Check if a Path Exists in the
$PATHin Fish?
- All About Functions
- How Do I Whip Up a Function in Fish?
- How Do I Craft a "Private" Function in Fish?
- Should Function Names and File Names Be a Perfect Match?
- Can I Fit Multiple Functions in a Single File?
- How Do I Reveal a Function's Definition in Fish?
- Exploring Functions, Builtins, and Commands in Fish
- Displaying the Fish Function Roster
- Verifying a Function's Existence in Fish
- All About Arguments
- All About Aliases
- IO
- Concurrency: Making Your Fish Swim Faster
- Glossary
- Contributing
Setting Sail
Ahoy there, matey! Prepare to embark on a grand adventure with our trusty mate, Fish. In this section, we'll guide you through the step-by-step setup process to ensure you're ready to navigate the command line seas like a true captain. Let's get your shipshape and ready for the voyage ahead!
How the Shell do I Install Fish?
If you're ready to dive into the wonderful world of Fish, here's how you can get your hands wet. You can either follow the official website for instructions, or stick around and sail through the directions provided here for your OS.
For macOS with Homebrew:
brew update && brew install fish
For Debian:
wget http://download.opensuse.org/repositories/shells:fish:release:2/Debian_8.0/Release.key
apt-key add - < Release.key
echo 'deb http://download.opensuse.org/repositories/shells:/fish:/release:/2/Debian_8.0/ /' >> /etc/apt/sources.list.d/fish.list
apt-get update
apt-get install fish
For Ubuntu:
sudo apt-add-repository ppa:fish-shell/release-2
sudo apt-get update
sudo apt-get install fish
For CentOS:
cd /etc/yum.repos.d/
wget http://download.opensuse.org/repositories/shells:fish:release:2/CentOS_7/shells:fish:release:2.repo
yum install fish
For Fedora:
dnf install fish
For Arch Linux:
pacman -S fish
For Gentoo:
emerge fish
For FreeBSD:
pkg install fish
For NetBSD:
pkgin install fish
For OpenBSD:
pkg_add fish
For the brave who want to build from source:
sudo apt-get -y install git gettext automake autoconf ncurses-dev build-essential libncurses5-dev
git clone -q --depth 1 https://github.com/fish-shell/fish-shell
cd fish-shell
autoreconf && ./configure
make && sudo make install
With Fish installed, a thrilling journey lies ahead. Gear up to explore the command line, unearthing Fish's core treasures and secrets. Here's to abundant and joyous fishing ventures! 🍻
Making Fish Your Default Shell, Ahoy!
Once you've installed Fish and it's safely located in your $PATH, for example, at /usr/local/bin, you can make it your default shell for a smooth sailing command line experience.
echo /usr/local/bin/fish | sudo tee -a /etc/shells
chsh -s /usr/local/bin/fish
Discovering Fish's Installation Location
Curious about where Fish is installed? Utilize the handy which command.
which fish
/usr/local/bin/fish
Where to Seek Help
If you find yourself in need of assistance or have burning questions about Fish, fret not. There's a treasure trove of resources awaiting you:
- Official Repository – Explore the official Fish repository on GitHub, where you can find the source code and contribute to the project.
- Tutorial – Set sail with the Fish tutorial, a step-by-step guide to help you master the shell's features and functionality.
- Documentation – Dive into the official documentation for Fish, where you'll discover a wealth of information and guidance.
r/fishshell– Join the community on Reddit, where fellow Fish enthusiasts gather to share their knowledge and adventures.- Gitter Channel – Hop aboard the Gitter Channel, a chat platform where you can engage with other Fish users and seek live assistance.
- StackOverflow
#fish– Cast your questions into the StackOverflow sea, specifically in the#fishtag, to receive guidance from the wider programming community. - awsm.fish – Discover a curated collection of prompts, plugins, and other hidden treasures to enhance your Fish journey. 🐚
Foundations
Decoding Prompts: What Are These Wiggly Characters?
The prompt is where you type commands and interact with Fish. Read more about the UNIX prompt here.
You might encounter something like this:
jb@mbp ~/C/cookbook>
The tilde ~ represents the home directory in a compact form, instead of /users/jb/home, /Users/jb, and so on.
The @ symbol is an arbitrary character chosen to separate the username jb from the computer's name mbp. You can learn to tailor your prompt to display only what's relevant to you.
The forward slash / serves as the path delimiter. At a glance, you can see that the current directory is inside the home directory, under Code/cookbook. The abbreviated path displays just C.
To customize the length of the abbreviated path, use:
set fish_prompt_pwd_dir_length NUMBER
Or, if you prefer not to have abbreviated paths:
set fish_prompt_pwd_dir_length 0
Then, your prompt will look like this:
jb@mbp ~/Code/cookbook>
The greater-than symbol > signifies the end of the prompt.
Not a fan of these conventions? Feel free to craft your own prompt to suit your preferences.
Where Am I in Fish?
Related Skills
YC-Killer
2.7kA library of enterprise-grade AI agents designed to democratize artificial intelligence and provide free, open-source alternatives to overvalued Y Combinator startups. If you are excited about democratizing AI access & AI agents, please star ⭐️ this repository and use the link in the readme to join our open source AI research team.
best-practices-researcher
The most comprehensive Claude Code skills registry | Web Search: https://skills-registry-web.vercel.app
groundhog
398Groundhog's primary purpose is to teach people how Cursor and all these other coding agents work under the hood. If you understand how these coding assistants work from first principles, then you can drive these tools harder (or perhaps make your own!).
isf-agent
a repo for an agent that helps researchers apply for isf funding
Security Score
Audited on Mar 31, 2026
