The Fast Interactive Shell is designed to be a lot more user friendly than traditional shells such as bash.
These other shells have a long history and often maintain strict compatibility with POSIX, something which fish omits in order to provide a rich modern feature set. It works exactly like other shells, it just wasn't written to follow the POSIX standard and the developers don't intend to.
#Why I use fish 🐟
- Adopts consistent syntax
- Easy to understand
- Syntax highlighting right out of the box!
- Friendly web-based configuration using the
- Auto suggestion based on history
- Tab completion from man pages
#Can I still use Bash?
Yep, sure can! If you have to use commands written in bash syntax, you can use the following, which will start a
bash process and execute the supplied command:
$ bash -c <command>
If you just want to drop into an interactive bash shell, use:
To exit, just type
Nowadays, for me this is the only way bash gets run. My personal Linux machine and work laptop are both configured to use fish.
If at any point you get stuck and can't work something out, fish has its own help which can be accessed using the
help command. This will open a new tab pointing to the documentations introductory
Every conceivable piece of information you could possibly need will be contained in here (thats also why this guide is a quick one, their documentation is just too good!).
#A few tips
As I mentioned above, fish can give you tab completions from man pages. This is incredibly helpful if you can't remember what you need to type.
Fish has to be "primed" with the man page data on your system. You do this by running:
So, when I initially switched to fish I had trouble finding where the configs were stored. It doesn't follow the usual
~/.zshrc pattern. Config files for fish are actually stored in
I guess it does mean that your home directory isn't as cluttered, since everything is placed under that
#Setting paths is different
The way you add items to your path is different (but simpler) in fish and there are a couple of ways to do it.
You can either use the
fish_user_paths universal variable:
set -U fish_user_paths <directory>
This adds the
<directory> to your path and is preserved across restarts, it's also the preferred mathod of setting your path.
The alternative is to set the
PATH variable directly as an executable instruction in your fish config:
set PATH <directory> $PATH
Be aware that many guides will not include fish-specific setup instructions, so you will have to get used to converting
$PATH additions into the fish equivalent.
#Nvm requires a different script
The original nvm script was written for POSIX-compliant shells and therefore can't be used by fish. The great news is: there's a 100% pure-fish implementation of nvm!
#Create a simple prompt
The prompt displayed in fish shell is a
function and can be modified by creating
My particular prompt is as simple as you can get:
function fish_prompt echo -n 'Л ' end
Of course, there's a ton of stuff you can do with your prompt, but I prefer having something simple & recognisable.
#Turn off the greeting
Fish prints a greeting on every startup:
Welcome to fish, the friendly interactive shell Type help for instructions on how to use fish
While that may be great the first few times, it becomes a bit tedious to look at after a while. Just run the following to turn this off:
$ set -U fish_greeting
Why not give fish a try? I'm really enjoying it and it makes working on the terminal just a little bit more fun.