The Random Thoughts of a Geek heading for Banbury
The Random Thoughts of a Geek heading for Banbury
1 3 4 6 7 8 A B D E F G H I J K L M N P R S T
Fi Fl Fo

Fish

According to Wikipedia Friendly interactive shell is:

Is a Unix shell that attempts to be more interactive and user-friendly than those with a longer history or those formulated as function-compatible replacements for the aforementioned. The design goal of fish is to give the user a rich set of powerful features in a way that is easy to discover, remember, and use.

The project site can be found at fishshell.com.

Installing Fish

OS X

Using Homebrew (which I recommend) and have configured your environment as noted in the macOS Setup Guide, then you can install Fish as you would any other package:

brew install fish

Once installation has completed, add Fish to /etc/shells, which will require an administrative password:

echo “/usr/local/bin/fish” | sudo tee -a /etc/shells

To make Fish your default shell:

chsh -s /usr/local/bin/fish

Debian

to get Fish we have to do some work:

echo 'deb http://download.opensuse.org/repositories/shells:/fish:/release:/2/Debian_9.0/ /' >> /etc/apt/sources.list.d/fish.list
wget -qO - http://download.opensuse.org/repositories/shells:fish:release:2/Debian_9.0/Release.key | apt-key add -
apt-get update
apt-get install fish -y

make fish default shell

sudo chsh -s /usr/bin/fish

Yes for some reason this needs the sudo!

=== Other users ===
if you edit ”/etc/passwd” as root look for the line for the user you want and change the shell path there: ”/usr/bin/fish”

==== Ubuntu ====

sudo apt-add-repository ppa:fish-shell/release-2
sudo apt-get update
sudo apt-get install fish -y

===== Configuration =====
mkdir -p ~/.config/fish
nano ~/.config/fish/config.fish

add the line ”set -g -x PATH /usr/local/bin $PATH”

fish_config
fish_update_completions

If you decide Fish isn’t for you and want to permanently revert your default shell back to Bash:

chsh -s /bin/bash

===== Aliases =====

alias name=’what you want it to do’
funcsave name

So a worked example is:
alias ls=’ls -FhlsA’
funcsave ls

aliases are saved in a file in the folder ”~/.config/fish/functions/”

{{tag>guide fish macOS}}