Get Started with Fish Shell: A Step-by-Step Guide to Installation and Comparison with Zsh and Bash

·

4 min read

Introduction to Fish Shell:

Fish shell is a smart and user-friendly shell for Unix-like operating systems. It is designed to be more human-friendly and interactive, making it easier for new users to start using the terminal. Fish shell provides advanced features like auto-suggestions, syntax highlighting, and support for a variety of programming languages and tools.

Some of the key features of Fish shell include:

  • Syntax highlighting: Fish shell highlights commands, parameters, and variables in different colors, making it easier to spot errors and understand the output.

  • Auto-suggestions: Fish shell provides real-time suggestions based on your command history, making it easier to reuse commands and avoid typos.

  • User-friendly interface: Fish shell provides a simple and intuitive interface that makes it easier for new users to start using the terminal.

  • Supports multiple programming languages: Fish shell provides built-in support for a variety of programming languages, including Python, Ruby, and Node.js.

Pros of Fish Shell over Zsh and Bash:

  1. User-friendly interface: Fish shell has a user-friendly interface that makes it easier for new users to start using the terminal.

  2. Auto-suggestions: Fish shell provides real-time suggestions based on your command history, making it easier to reuse commands and avoid typos.

  3. Syntax highlighting: Fish shell highlights commands, parameters, and variables in different colors, making it easier to spot errors and understand the output.

  4. Built-in support for multiple programming languages: Fish shell provides built-in support for a variety of programming languages, including Python, Ruby, and Node.js.

Cons of Fish Shell compared to Zsh and Bash:

  1. Limited community support: While Fish shell has a growing community, it still lags behind Zsh and Bash in terms of community support and the availability of plugins and themes.

  2. Lack of compatibility with shell scripts: Fish shell uses a different syntax compared to Zsh and Bash, which can cause compatibility issues when trying to run shell scripts written for Zsh or Bash.

  3. Performance: Fish shell can be slower compared to Zsh and Bash, especially when running complex commands or scripts.

How to Install Fish Shell:

Fish shell can be installed on various operating systems, including macOS, Linux, and Windows. Here's how to install it on each platform:

macOS:

  1. Install Homebrew: Fish shell can be installed via the Homebrew package manager on macOS. To install Homebrew, open Terminal and run the following command:

     /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
    
  2. Install Fish shell: Once Homebrew is installed, run the following command to install Fish shell:

     brew install fish
    
  3. Set Fish shell as the default shell: To set Fish shell as the default shell, run the following command:

     echo "/usr/local/bin/fish" | sudo tee -a /etc/shells
     chsh -s /usr/local/bin/fish
    

Linux:

  1. Install Fish shell: Fish shell can be installed using the package manager for your Linux distribution. For example, on Ubuntu, you can run the following command to install Fish shell:

     sudo apt-get install fish
    
  2. Set Fish shell as the default shell: To set Fish shell as the default shell, run the following command:

     chsh -s /usr/bin/fish
    

Windows:

  1. Install Windows Subsystem for Linux (WSL): Fish shell is not natively supported on Windows, but it can be installed via the Windows Subsystem for Linux (WSL). To install WSL, follow these steps:

    • Open the Microsoft Store and search for "Windows Subsystem for Linux".

    • Install the "Windows Subsystem for Linux" app.

    • Restart your computer.

  2. Install Fish shell: Once WSL is installed, you can install Fish shell by running the following command in the Linux terminal:

     sudo apt-get install fish
    
  3. Set Fish shell as the default shell: To set Fish shell as the default shell, run the following command:

     echo "/usr/bin/fish" | sudo tee -a /etc/shells
     chsh -s /usr/bin/fish
    

Conclusion

In conclusion, Fish shell provides a user-friendly and advanced shell environment that makes it easier to use the terminal, but it may not be the best choice for experienced users or those who need compatibility with shell scripts. It is important to weigh the pros and cons of Fish shell when deciding whether it is the right choice for your needs.

Did you find this article valuable?

Support Adi's blog by becoming a sponsor. Any amount is appreciated!