On this page
My Fish config: https://github.com/mrmartineau/fish
Change fish settings:
Reload fish shell
Switching to fish? Jump to heading
If you wish to use fish (or any other shell) as your default shell, you need to enter your new shell’s executable in two places.
Add the shell to
echo /usr/local/bin/fish | sudo tee -a /etc/shells
ℹ️ homebrew may install fish to
Change your default shell with:
chsh -s /usr/local/bin/fish
This assumes you installed fish to
/usr/local/bin, which is the default location when you’ve compiled it yourself. If you installed it with a package manager, the usual location is
/usr/bin/fish, but package managers typically already add it to
/etc/shells. Just substitute the correct location.
(To change it back to another shell, substitute
/bin/zsh as appropriate in the steps above.)
Fish features Jump to heading
Functions Jump to heading
Create new functions in
Aliases Jump to heading
alias is a simple wrapper for the
function builtin, which creates a function wrapping a command.
alias gco 'git checkout'
alias undocommit 'git reset HEAD~1'
alias ya 'yarn add'
alias yad 'yarn add -D'
abbr Jump to heading
If you add an abbreviation instead of an alias you’ll get better auto-complete. In fish abbr more closely matches the behavior of a bash alias.
abbr -a gco git checkout
Will add a new abbreviation
gco that expands to
Fish plugins Jump to heading
Fisher Jump to heading
Plugins are listed in the
curl -sL https://git.io/fisher | source && fisher install jorgebucaran/fisher
Install a plugin:
fisher install email@example.com
Other info Jump to heading
Set shell variables Jump to heading
set -xg PATH /usr/local/sbin $PATH
Jump to heading
List all $PATH entries Jump to heading
string join \n $PATH | nl
Jump to heading
When needing to add ssh keys to Github, the docs suggest running
eval "$(ssh-agent -s)" but that does not work in fish. Run this instead:
command ssh-agent -s
Executing Bash Jump to heading
If fish is your default shell and you want to copy commands from the internet that are written in bash (the default shell on most systems), you can proceed in one of the following two ways:
Use the bash command with the -c switch to read from a string:
$ bash -c 'some bash command'
Use bash without a switch to open a bash shell you can use and exit afterward:
$ some bash command
← Back home