RHEL BasedRocky Linux

How To Install Fish Shell on Rocky Linux 9

Install Fish Shell on Rocky Linux 9

Rocky Linux 9 is a robust and reliable Linux distribution, offering users a stable platform for various computing needs. One way to enhance your command-line experience on Rocky Linux is by installing the Fish Shell, known for its user-friendly features like syntax highlighting and autosuggestions.

Fish Shell, also known as the Friendly Interactive Shell, is designed to make the command-line interface more accessible and intuitive. It offers several features that improve user experience, including:

  • Syntax Highlighting: Fish Shell highlights commands as you type them, making it easier to identify syntax errors.
  • Autosuggestions: It provides suggestions based on your command history and common commands, which can be selected using the Tab key.
  • Web-Based Configuration: Fish Shell allows users to configure settings through a web interface, making customization more accessible.

Benefits of Using Fish Shell

Using Fish Shell can significantly enhance your productivity and command-line experience:

  • Improved User Experience: The interactive features of Fish Shell make it easier for beginners to learn and use the command line.
  • Efficiency: Autosuggestions and syntax highlighting help reduce errors and speed up command execution.
  • Customization: Fish Shell is highly customizable, allowing users to personalize their command-line environment.

Preparing Rocky Linux 9 for Installation

Before installing Fish Shell, ensure your Rocky Linux 9 system is up to date:

  1. Update the System: Open a terminal and run the following command to update your system:
    sudo dnf update
  2. Check for Existing Installation: Verify if Fish Shell is already installed by running:
    fish --version

    If Fish Shell is installed, you will see the version number; otherwise, proceed with the installation.

Installing Fish Shell on Rocky Linux 9

Installing Fish Shell on Rocky Linux 9 is straightforward using the DNF package manager:

  1. Install Fish Shell: Execute the following command in your terminal:
    sudo dnf install fish
  2. Verify Installation: After installation, confirm that Fish Shell is installed by running:
    fish --version

Setting Fish Shell as the Default Shell

To make Fish Shell your default shell, follow these steps:

  1. Install util-linux-user: This package is necessary for changing the default shell. Install it using:
    sudo dnf install util-linux-user
  2. Change Default Shell: Run the following command to set Fish Shell as default:
    chsh -s /usr/bin/fish

    You will be prompted to enter your password.

  3. Log Out and Log In: For the changes to take effect, log out of your current session and log back in.

Install Fish Shell on Rocky Linux 9

Configuring Fish Shell

Fish Shell offers extensive customization options:

Configuration Files

Fish Shell stores its configuration in `~/.config/fish/config.fish`. You can edit this file to add custom settings, such as environment variables or aliases.

Customizing the Prompt

To enhance your prompt, you can use Oh My Fish, a framework for managing Fish Shell themes and plugins:

  1. Install Git: Ensure Git is installed to clone Oh My Fish:
    sudo dnf install git
  2. Install Oh My Fish: Run the following command to install Oh My Fish:
    curl https://raw.githubusercontent.com/oh-my-fish/oh-my-fish/master/bin/install | fish
  3. Install Themes: Oh My Fish allows you to install various themes. For example, to install the `bobthefish` theme, use:
    omf install bobthefish

Setting Environment Variables

You can add directories to the PATH or set environment variables in your `~/.config/fish/config.fish` file. For example, to add a directory to the PATH:

set -x PATH $PATH /path/to/directory

Creating Aliases

Aliases can simplify common commands. To create an alias, add the following line to your `config.fish` file:

alias ll='ls -l'

Advanced Customization with Starship

Starship is a popular prompt for Fish Shell that offers customizable status lines:

  1. Install Starship: Download and install Starship using the following command:
    curl -sS https://starship.rs/install.sh | sh
  2. Configure Starship in Fish: Add the following line to your `~/.config/fish/config.fish` to enable Starship:
    source ~/.local/share/starship/init.fish

Troubleshooting Common Issues

  • Installation Errors: Ensure your system is updated and that the Fish Shell package is available in your repositories.
  • POSIX Compatibility: Fish Shell is not POSIX compliant, which might cause issues with scripts. Use a shebang (`#!/bin/bash`) to specify the shell for scripts.
  • SSH Remote Commands: When using SSH with Fish Shell, ensure commands are properly quoted to avoid syntax errors.

Congratulations! You have successfully installed Fish Shell. Thanks for using this tutorial for installing the Fish Shell on your Rocky Linux 9 system. For additional or useful information, we recommend you check the official Fish Shell website.

VPS Manage Service Offer
If you don’t have time to do all of this stuff, or if this is not your area of expertise, we offer a service to do “VPS Manage Service Offer”, starting from $10 (Paypal payment). Please contact us to get the best deal!

r00t

r00t is an experienced Linux enthusiast and technical writer with a passion for open-source software. With years of hands-on experience in various Linux distributions, r00t has developed a deep understanding of the Linux ecosystem and its powerful tools. He holds certifications in SCE and has contributed to several open-source projects. r00t is dedicated to sharing her knowledge and expertise through well-researched and informative articles, helping others navigate the world of Linux with confidence.
Back to top button