Fish shell user introduction
I have been usingFish shellFor months, I think this is the best shell I have ever used. Because of many reasons.
Although Bash is great, it is a very basic shell with a limited set of configurable options. I tend to use it mainly for runningBash script(This is another topic), not as an interactive shell. Zsh provides many functions, but some configuration is required to set it up, which may make beginners feel scared. In addition, too many options and degrees of freedom mean that you can easily fall into configuration paralysis, and eventually have to change options 20 times a week to ensure that you don't miss any opportunities.
I don't want to be "confusing" on those projects. It's amazing. I spent a lot of time and still use it sometimes. This description is my attempt to emphasize the benefits of fish
The fish shell comes to the rescue! The enclosure provides an amazing environment and has a fully functional configuration out of the box.
Fish's favorite features are:
- It provides a better auto-completion function for the commands you have executed, and this alone can make my daily work faster and more labor-saving.
- You start typing a command and then press
upKey to view all the times in the shell history of your previous use of the command.
- You can install Fish on any system, and Fish can work in the same way anywhere without having to do too much customization to get beautiful things.
In terms of scripting, it is completely different from Bash script (to be better IMHO), but you can run any Bash script prefixed with Bash script.
After the installation is complete, you will get the following benefits:
- Syntax highlighting
- A good tip
- Parameter suggestions suggested in the man page
- Web-based configuration
I think this is the best shell for beginners.
I remember one of the interesting things I noticed was the homepage. At first, I didn’t know if it was a relic of the past:
For those lucky ones who have a graphics computer, you can set colors and view functions, variables, and history from a web page.
Then I realized that this was programmer humor, which made me laugh. Technology should always be fun, right?
First of all, what is a shell?
Shell is the interface of the basic operating system. It allows you to perform operations using text and commands, and provides users with advanced features, such as the ability to create scripts.
Install Fish by running
brew install fishOn macOS.
Look at minemacOS terminal guide
Since this is probably already in your path, run
fishStart fish shell (type
exitReturn to your default shell)
The good thing about Fish is the web-based configuration. run
fish_configStart the web client.
From here you can
- Choose a color scheme from a list of predefined colors
- Select a reminder from a list of predefined reminders
- Check the configured Fish functions and variables
- View command history
The configuration is stored in
~/.config/fishFolder, you can edit in it without having to use the (optional) web-based configuration.
Fish function: syntax highlighting, auto-completion and parameter suggestions with manual page prompts
Fish enables you to execute regular Unix commands available on the system. File system operations, such as:
rmDelete files or folders
mvMove the file to another folder, or change the file name
If you run one of these commands (or
anyCommand, actually) and you will start to see the words you type in different colors. It makes it very easy to read and understand commands.
The fish can also increase the automatic completion function. If you run
cd ~/.config/fish/Before, now you type
cd, Fish will prompt you for commands that you might want to type, you just need to press the right arrow to accept the suggestion (or you can continue typing to change the command). This recommendation is based on the command history and file path.
Recommendations based on auto-completion also apply to commands. I enter here
cAnd press the tab:
Fish also suggests parameters and how to use them. Types of
ls -then press
tab. The list of parameters you can use and their meanings is as follows:
This inline help is fromMan page, Useful shell help (try to run
man lsFor complete help).
Set Fish as the default shell
If you like Fish and try to set it as the default shell, please open the file
/etc/shells. I use
picoDo those small file edits
pico /etc/shells, But you can use any editor you like, and you can even combine VS Code with
It should contain content similar to the following:
# List of acceptable shells for chpass(1). # Ftpd will not allow users to connect who are not using # one of these shells.
/bin/bash /bin/csh /bin/ksh /bin/sh /bin/tcsh /bin/zsh
Add the following line at the end to add the Fish shell:
chsh -s /usr/local/bin/fish
enter your password, and the shell will change for your user.
You can install Fish plugins.
Fisher is a popular Fish package manager.
Install it using
curl https://git.io/fisher --create-dirs -sLo ~/.config/fish/functions/fisher.fish
and it’s available with the
Now a package can be installed using
fisher add <github-repository-path>and removed using
fisher rm <github-repository-path>.
List all plugins installed using
fisherto update all the packages you installed.
Popular plugins are
Here is a list of packages you can install.
Various shells comply with the POSIX shell command standard.
- X (for Unix)
and it’s a standard meant to unify the various Unix environment that were built over time. There is a shell command standard subset, which is meant as a way to unify how Unix shells work.
Unix is a specification/standard for a family of operating systems. Linux and macOS are based on Unix (Windows is not).
kshand others are POSIX compliant. Being POSIX compliant makes scripts written with POSIX compatibility work across POSIX compliant shells.
cshfor example) is not compliant, so it’s not a POSIX shell, and this means that writing commands and scripts for Fish is different. Scripts written for Fish won’t work outside of Fish. Just like
cshscripts only work on csh (and derivatives)
Why is it different? Various reasons, but I imagine having to support POSIX means the shell must adhere to a common language that might interfere with the shell philosophy and way of working. Not everyone want to have that baggage of tech to support forever.
This will very rarely be a problem with executing commands, but you need to keep it in mind when it comes to scripting and programming.
Download my free Linux Commands Handbook
More cli tutorials:
- The Bash shell
- Introduction to Bash Shell Scripting
- The Fish Shell
- Shell, watch file content as it populates
- How to exit Vim
- UNIX Editors
- The UNIX Filesystem Commands
- Unix Shells Tutorial
- How to set an alias in a macOS or Linux shell
- A practical guide to Homebrew
- How to fix the xcrun invalid active developer path error in macOS
- The Command Line for Complete Beginners
- Introduction to Linux
- How to find the process that is using a port
- Linux commands: mkdir
- Linux commands: cd
- Linux commands: pwd
- Linux commands: rmdir
- Linux commands: ls
- Linux commands: mv
- Linux commands: cp
- Linux commands: less
- Linux commands: tail
- Linux commands: touch
- Linux commands: cat
- Linux commands: find
- Linux commands: ln
- Linux commands: ps
- Linux commands: echo
- Linux commands: top
- Linux commands: kill
- Linux commands: killall
- Linux commands: alias
- Linux commands: jobs
- Linux commands: bg
- Linux commands: fg
- Linux commands: type
- Linux commands: which
- Linux commands: whoami
- Linux commands: who
- Linux commands: clear
- Linux commands: su
- Linux commands: sudo
- Linux commands: chown
- Linux commands: chmod
- Linux commands: passwd
- Linux commands: open
- Linux commands: wc
- Linux commands: history
- Linux commands: du
- Linux commands: umask
- Linux commands: grep
- Linux commands: man
- Linux commands: uname
- Linux commands: sort
- Linux commands: uniq
- Linux commands: diff
- Linux commands: nohup
- Linux commands: df
- Linux commands: xargs
- Linux commands: gzip
- Linux commands: gunzip
- Linux commands: ping
- Linux commands: traceroute
- Linux commands: tar
- Linux commands: export
- Linux commands: crontab
- Linux commands: dirname
- Linux commands: basename
- Linux commands: printenv
- Linux commands: env
- A short guide to the ed editor
- A short guide to vim
- A short guide to emacs
- A short guide to nano
- Linux, no space left on device
- How to use Netcat