ScottSpence.com

Scott's Digital Garden.

🤫This is a private post👀

Fish Shell Introduction

As a developer you spend a lot of time in the terminal so it’s important to be happy and as productive as possible whilst you’re in there.

This is why I’m a big fan of the Fish Shell in particular. The Fish Shell is a user friendly shell with really handy features like auto-suggestions and tab completions that come preconfigured, no need to install additional plugins and mess around with config files. That’s not to say Fish Shell isn’t configurable, there are plugins available.

Ok, let’s look at a typical navigation example in bash, if you want to change directory, you have to enter cd followed by the directory name. In Fish you only need to type out the directory name.

Similarly if you want to go back a directory in bash, you need to start with cd in Fish it’s just a case of ../.

1# change directories in bash
2cd Downloads
3cd ../
4# change directories in fish
5Downloads/
6../

Auto-suggestions

Fish will suggest both directories and commands as you type away, you will see suggestions in grey which you can tab onto to select.

If you want to go through you last yarn (or npm) commands, rather than (like in bash) arrow through all you previously entered commands (I know you can use Ctr+r in bash) or print out the history and look at that.

In Fish if you start typing out your command, let’s say yarn you can then arrow through all commands that have included yarn it doesn’t even have to be the beginning of the command, if you have used a package and want to know what else you installed with it at the time you can use the package name then arrow though all command with that keyword in there.

Tab Completions

Aliases

Aliases are where you’re too lazy to keep typing in the full command again and again so you make a shorter one, for me I have aliased git to g in Fish, (I know, but that extra two characters over time is a lot).

Aliases in shells like bash and zsh you need to open your config file and find a appropriate place to add you alias. In

Install Fish shell

Linux and Windows Subsystem Linux:

1sudo apt -y install fish

macOS:

1brew install fish
2curl -L https://get.oh-my.fish | fish
3sudo bash -c 'echo /usr/local/bin/fish >> /etc/shells'
4chsh -s /usr/local/bin/fish

Oh My Fish (OMF)

Oh My Fish is touted as the Fishshell Framework but all I have used it for is the extensive themes available, once you have installed OMF you can list them out in the terminal with: omf theme

There’s previews available on the OMF Themes Markdown doc.

To install OMF, in the terminal enter the following command:

1curl -L https://get.oh-my.fish | fish

An extensive list of packages available too

1omf describe brew
1Package: brew
2Description: Oh My Fish plugin to integrate Homebrew paths into shell.
3Repository: https://github.com/oh-my-fish/plugin-brew
4Maintainer:

Back to Top