๐Ÿ‡ฏ๐Ÿ‡ต ๆ—ฅๆœฌ่ชž | ๐Ÿ‡บ๐Ÿ‡ธ English | ๐Ÿ‡ช๐Ÿ‡ธ Espaรฑol | ๐Ÿ‡ต๐Ÿ‡น Portuguรชs | ๐Ÿ‡น๐Ÿ‡ญ เน„เธ—เธข | ๐Ÿ‡จ๐Ÿ‡ณ ไธญๆ–‡

Don't Be Afraid of the Black Screen! Make Your Terminal Life Better with Fish Shell

In web production and development, command-line operations in the "terminal," that infamous black screen, are unavoidable. It can be intimidating at first, and it's easy to get discouraged when errors pop up. But what if the terminal could be more intuitive, like a friendly assistant?

The "Fish shell" we're introducing today is a tool that makes that dream a reality. It comes standard with powerful features like autosuggestions and syntax highlighting, making command-line operations surprisingly comfortable even for beginners. In this article, we'll carefully explain everything from installing the fish shell to setting up your fish environment to drastically improve your development workflow, and cover the basic fish configuration methodsโ€”all with code you can just copy and paste. Let's experience something that "just works" together! ๐Ÿš€


What Is Fish Shell? Why Is It Recommended?

Fish stands for "Friendly Interactive Shell," and as the name suggests, it's developed to be a user-friendly and interactive shell. Compared to "Bash," the standard shell on many Linux and macOS systems, or "Zsh," which is popular for its high customizability, Fish's greatest feature is that its powerful functions are available right out of the box with no configuration required.

Thanks to these features, you'll make far fewer typos, and your work efficiency will skyrocket. It's truly a powerful ally for beginner web creators.


How to Install Fish Shell

Let's get Fish installed on your system right away. We'll show you the steps for both macOS and Linux (Ubuntu/Debian-based).

For macOS (Homebrew)

On macOS, the easiest way is to use the package manager Homebrew. If you haven't installed Homebrew yet, be sure to do that first by following the instructions on its official website.

Open your terminal and run the following command.

brew install fish

For Linux (Ubuntu / Debian-based)

If you're using Ubuntu, Debian, or a derivative distribution, you can install it with the `apt` command.

First, update your repository information.

sudo apt update

Next, install Fish.

sudo apt install fish

Changing Your Default Shell to Fish

Once the installation is complete, let's change your "default shell" so that Fish starts automatically whenever you open a terminal. This completes the full setup of fish.

First, find out where Fish was installed (its path). It's usually `/usr/local/bin/fish` (macOS) or `/usr/bin/fish` (Linux).

which fish

Next, use the `chsh` (change shell) command to change your default shell to the Fish path you just found. Use the `-s` option followed by the path.

chsh -s $(which fish)

You'll be prompted to enter your password; type in your login password. That's it for the setup! To apply the changes, completely quit your terminal and restart it.

If you see a welcome message like the one below when you open a new terminal, you've succeeded.

Welcome to fish, the friendly interactive shell
  Type help for instructions on how to use fish

Experience Initial Fish Setup (fish_config)

One of the great things about Fish is its easy configuration via a web browser. With this initial fish setup feature, you can freely change the appearance (prompt) and colors without knowing any commands at all.

Try running the following command in your terminal.

fish_config

A web browser will automatically open to a configuration screen. You can choose your favorite color scheme in the "Colors" tab or try out various prompt designs in the "Prompt" tab. When you find a setting you like, just click the "Set Theme" or "Set Prompt" button at the top, and it will be instantly applied to your terminal. It's that easy!

Customizing Fish with a Configuration File (config.fish)

While the browser configuration is convenient, if you want more detailed customizations, you'll edit the `config.fish` file directly. This fish configuration method is the first step toward building a serious fish environment.

The configuration file is located at `~/.config/fish/config.fish`. If it doesn't exist yet, let's create it.

First, create the directory for the configuration file.

mkdir -p ~/.config/fish

Next, create an empty configuration file.

touch ~/.config/fish/config.fish

Now you're ready. Open this file in your favorite editor (like VSCode) and start writing your configurations.

Advanced Example 1: Setting an Alias

An "alias" is a feature that lets you call long, frequently used commands with a short keyword. For example, let's make it so you can run the `ls -lha` command with just `ll`.

Add the following line to your `config.fish`.

alias ll="ls -lha"

Advanced Example 2: Setting Environment Variables

Some development tools require you to set specific "environment variables." For example, if you mainly use VSCode as your editor, setting the `EDITOR` environment variable can be convenient.

Add the following line to `config.fish`. The key point is that unlike Bash's `export`, Fish uses `set -x`.

set -x EDITOR "code"

After saving the file, open a new terminal or run `source ~/.config/fish/config.fish` to apply the changes.


Things to Watch Out For: Differences from Bash

Fish is a very user-friendly shell, but there are a few key syntax differences to be aware of if you're coming from Bash or Zsh.

You might run into errors because of these differences when copying and pasting commands from web articles or tutorials. If you get an error like "command not found," these syntax differences might be the cause. You'll get used to them over time.


Conclusion

In this article, we've covered everything from installing the fish shell to basic environment setup and initial configuration. The powerful autosuggestions and color highlighting, available right out of the box, will significantly reduce the stress of terminal operations. It might take some getting used to at first, but since it's a tool you'll use every day, it's well worth choosing the one that's most comfortable for you.

We hope this article inspires you to give Fish shell a try and start your comfortable command-line life!


Next Steps

Now that you've completed the basic setup for Fish, let's experience its powerful features firsthand! The following article explains in detail, with concrete demos, why Fish is said to be so "user-friendly," focusing on its signature autosuggestion, color highlighting, and history features.

Try Out Fish Shell's Powerful Autosuggestions, Color Highlighting, and History Features