DEV Community

Cover image for My Linux Fish Shell Workflow
Rishit Pandey
Rishit Pandey

Posted on

My Linux Fish Shell Workflow

Hey Everyone!, I will be sharing my fish shell workflow on linux and how to set it up for your productivity boost.
Let's get started!

A little about fish shell

So you know about bash and zsh and how they work right? The fish shell is not like those shells. I mean they kinda have similarities but they do differ very much. ZSH can execute bash commands in a native as bash does but fish shell requires some editing to it specially when it comes to setting variables and exporting paths.

Fish Shell Workflow

What's my workflow?

I usually work on the terminals only and for that I frequent switch between different directories, editing them in vim (I use neovim), etc. So for me having a built-in autocompletion for shell with syntax highlighting and is a plus point.
With that I also use this. This is a fish shell tool for jumping different directories with two word command.
For example, I have a very nested directory that I want to visit and from there I need to go to another nested directory and let's name the first directory as portfolio and my terminal config. Now for that I use the z tool and using the z tool I can create aliases for that directory.

z portfolio
Enter fullscreen mode Exit fullscreen mode

You can create the alias for that directory by going to that directory and then run

z <short-name-of-that-directory>
Enter fullscreen mode Exit fullscreen mode

Now go back to your home directory and then run

z <name-of-that-directory>
Enter fullscreen mode Exit fullscreen mode

and whoosh! you are straight into that directory.

Now I know some of you will say that we can create aliases in the shell itself but for that you have to go to its config file and then add that alias and the source the config file for every directory. Z tool helps to create aliases on the fly.

For the fish prompt, I use starship cross-platform shell prompt. Its very minimal and easy to use with all the information you need for the directory is being displayed on your terminal in a very minimal way.

Fish Shell Workflow

How to set it up?

So first we will install fish shell.
For mac users,

brew install fish
Enter fullscreen mode Exit fullscreen mode

For linux user, (chad users)

sudo pacman -S fish
sudo dnf install fish
sudo apt install fish
Enter fullscreen mode Exit fullscreen mode

Once the shell is installed, we will change the default shell for the user,

chsh -S /usr/bin/fish
Enter fullscreen mode Exit fullscreen mode

If you just want to try out the fish shell, you can enter into fish shell just by running fish in your terminal.

Then we need to install a package manager for fish shell. The name is fisher. Fisher is a package manager for fish shell and is very fast.
Install fisher by running,

curl -sL https://git.io/fisher | source && fisher install jorgebucaran/fisher
Enter fullscreen mode Exit fullscreen mode

Now the package manager is installed we can move on to installing and customizing the shell.

Add tools and Customize your shell!

First we will install z tool. Using fisher we can run,

fisher install jethrokuan/z
Enter fullscreen mode Exit fullscreen mode

Now you can create aliases for your directories and jump across them.

For the prompt, I use Starship Prompt. For installing this I had some problem while running the below command in fish so I went to bash shell and executed the command and it installed the prompt successfully.

sh -c "$(curl -fsSL https://starship.rs/install.sh)"
Enter fullscreen mode Exit fullscreen mode

The problem I faced was because of the different syntax that fish uses in contrast of what bash and zsh use.

Now you can also customize the prompt itself using a config file. I have my config here or you can read the starship docs here.

Thats it! Enjoy with your new terminal friend.

Extras

  • You can also use tide which is powerlevel10k for fish and is much more customizable too.
  • Also for icon support in the terminal while displaying directories, you can visit ptSh and exa.

Thanks for taking time to read and I appreciate your interest in my blog. This is my first blog so feel free to point out the mistakes and I will surely learn from them!

Top comments (0)