Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to install, configure and use Fish Shell in Linux

2025-01-21 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly explains "how to install, configure and use Fish Shell in Linux". The content in the article is simple and clear and easy to learn and understand. Please follow the editor's train of thought to study and learn how to install, configure and use Fish Shell in Linux.

What is Fish Shell?

Fish is a friendly interactive shell, a fully functional, intelligent and user-friendly Linux command line shell with some convenient features that are not available in most shell.

These features include automatic completion recommendations, Sane Scripting, man page completion, Web-based configurator, and Glorious VGA Color. Are you curious about it and want to test it? If so, follow the installation steps below to continue the installation.

How do I install Fish Shell in Linux?

Its installation is so simple that it does not exist in most distributions except for a few distributions. However, you can easily install using the following fish repository.

For Arch Linux-based systems, use the Pacman command to install fish shell.

$sudo pacman-S fish

For the Ubuntu 16.04Comp18.04 system, use the APT-GET command or the APT command to install fish shell.

$sudo apt-add-repository ppa:fish-shell/release-3$ sudo apt-get update$ sudo apt-get install fish

For Fedora systems, use the DNF command to install fish shell.

For Fedora 29 systems:

$sudo dnf config-manager-- add-repo https://download.opensuse.org/repositories/shells:/fish:/release:/3/Fedora_29/shells:fish:release:3.repo$ sudo dnf install fish

For Fedora 28 systems:

$sudo dnf config-manager-- add-repo https://download.opensuse.org/repositories/shells:/fish:/release:/3/Fedora_28/shells:fish:release:3.repo$ sudo dnf install fish

For Debian systems, use the APT-GET command or the APT command to install fish shell.

For Debian 9 systems:

$sudo wget-nv https://download.opensuse.org/repositories/shells:fish:release:3/Debian_9.0/Release.key-O Release.key$ sudo apt-key add-

< Release.key$ sudo echo 'deb http://download.opensuse.org/repositories/shells:/fish:/release:/3/Debian_9.0/ /' >

/ etc/apt/sources.list.d/shells:fish:release:3.list$ sudo apt-get update$ sudo apt-get install fish

For Debian 8 systems:

$sudo wget-nv https://download.opensuse.org/repositories/shells:fish:release:3/Debian_8.0/Release.key-O Release.key$ sudo apt-key add-

< Release.key$ sudo echo 'deb http://download.opensuse.org/repositories/shells:/fish:/release:/3/Debian_8.0/ /' >

/ etc/apt/sources.list.d/shells:fish:release:3.list$ sudo apt-get update$ sudo apt-get install fish

For RHEL/CentOS systems, use the YUM command to install fish shell.

For RHEL 7 systems:

$sudo yum-config-manager-- add-repo https://download.opensuse.org/repositories/shells:/fish:/release:/3/RHEL_7/shells:fish:release:3.repo$ sudo yum install fish

For RHEL 6 systems:

$sudo yum-config-manager-- add-repo https://download.opensuse.org/repositories/shells:/fish:/release:/3/RedHat_RHEL-6/shells:fish:release:3.repo$ sudo yum install fish

For CentOS 7 systems:

$sudo yum-config-manager-- add-repo https://download.opensuse.org/repositories/shells:fish:release:2/CentOS_7/shells:fish:release:2.repo$ sudo yum install fish

For CentOS 6 systems:

$sudo yum-config-manager-- add-repo https://download.opensuse.org/repositories/shells:fish:release:2/CentOS_6/shells:fish:release:2.repo$ sudo yum install fish

For openSUSE Leap systems, use the Zypper command to install fish shell.

How does $sudo zypper addrepo https://download.opensuse.org/repositories/shells:/fish:/release:/3/openSUSE_Leap_42.3/shells:fish:release:3.repo$ suod zypper refresh$ sudo zypper install fish use Fish Shell?

Once you have successfully installed fish shell. Just type fish on your terminal and it will automatically switch from the default bash shell to fish shell.

$fish

Automatic completion recommendation

When you type any command in fish shell, it automatically suggests a command in light gray after entering a few letters.

Once you get a suggestion and press the right cursor button, you can complete it instead of typing the full command.

You can immediately press the up cursor key to retrieve the previous history of the command after typing a few letters. It is similar to the CTRL+r option of bash shell.

Tab completion

If you want to see if there are other possibilities for a given command, just press the Tab key after typing a few letters.

Press Tab again to see the complete list.

Syntax highlighting

Fish will highlight the syntax, which you can see when you type any command in the terminal. Invalid commands are shaded as RED color.

Similarly, valid commands are displayed in different colors. In addition, when you type a valid file path, fish will underline it, and if the path is not valid, it will not be underlined.

Configurator based on Web

There is a cool feature in fish shell that allows us to set colors, prompts, functions, variables, history, and key bindings through a web browser.

Run the following command on the terminal to launch the Web configuration interface. Just press Ctrl+c to exit.

$fish_configWeb config started at 'file:///home/daygeek/.cache/fish/web_config-86ZF5P.html'. Hit enter to stop.qt5ct: using qt5ct plugin ^ CShutting down.

Manual page completion

Other shell supports programmable patching, but only fish can automatically generate them by parsing installed man pages.

To use this feature, run the following command:

$fish_update_completionsParsing man pages and writing completions to / home/daygeek/.local/share/fish/generated_completions/ 3466 / 3466: how zramctl.8.gz sets Fish as the default shell

If you want to test fish shell for a while, you can set fish shell as the default shell instead of switching it every time.

To do this, first use the following command to get the location of the Fish Shell.

$whereis fishfish: / usr/bin/fish / etc/fish / usr/share/fish / usr/share/man/man1/fish.1.gz

Change the default shell to fish shell by running the following command.

$chsh-s / usr/bin/fish

Tip: just verify that Fish Shell has been added to the / etc/shells directory. If not, run the following command to attach it.

$echo / usr/bin/fish | sudo tee-a / etc/shells

After completing the test, if you want to return bash shell, use the following command.

Temporarily return:

$bash

* returned:

$chsh-s / bin/bash Thank you for reading, the above is the content of "how to install, configure and use Fish Shell in Linux". After the study of this article, I believe you have a deeper understanding of how to install, configure and use Fish Shell in Linux. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report