Approachable and Beautiful Command Line with Fish and Starship

Posted on Dec 31, 2020

The command line can be daunting, just like programming can. It gives you a blank line to input commands, but what do you input? Even after you learn how to do a few things you have to remember the exact text to input and repeatedly type the same commands.

On the other hand command line interfaces (CLI) are incredibly powerful. They enables the most granular visibility into and control over your computers functions. They are also one of the easiest ways to give an application an interface, so knowing how to use them enables users to take advantage of many applications that were previously inaccessible. In some cases, like git, where there are graphical interfaces available, the CLI is still the best way to interact with an application.

Fortunately there are ways to mitigate the difficulties of the command line and unlock the potential of the command line interface. When I first started programming I went into the command line as infrequently as possible and rued the time I spent there. Then I discovered oh my zsh , a framework for managing zsh, the z shell. This drastically improved my command line experience, but required a lot of setup.

Recently I discovered Starship and Fish . They provided all of the functionality I loved in oh my zsh , but in a more attractive package that was incredibly easy to set up.

Prompts and History

Fish Shell

  • Remembers your command history, so you don’t have to fully remember, or repeatedly type the same thing.
  • Fills out commands based on context, especially folder and file names.

Context and Style

Starship

  • Displays contextual information on your location in the file structure, git, accounts.
  • Adds color to improve your ability to parse the context and improve the aesthetic.

Installation

  1. Fish Shell installation will depend on your platform. Their home page has guides for every operating stystem in the Go fish section.
  2. Starship installation is also platform specific. Their documentation walks through how to how to install it and add it to fish shell .
  3. Set Fish as your default shell. This is again platform specific.
    • On Mac OS I had difficulty doing this because brew installed fish shell in a different folder than the other shells.
    • First run sudo sh -c 'echo /usr/local/bin/fish >> /etc/shells' to add Fish Shell to your shells.
    • Then run chsh -s /usr/local/bin/fish to set Fish Shell as your default.

Conclusion

This does not seem like a lot of features, or even particularly complex ones, but they make a world of difference.