FreeBSD: Install And Use Fish Shell
This post was last updated on August 1st, 2020 at 09:04 am
In FreeBSD, a shell is a program that interprets the command, executes, takes input(s), and prints output(s) on the terminal. A shell acts as an intermediary between user and kernel. FreeBSD uses tcsh as the default root shell and sh as the default user shell.
Fish is a feature-rich, smart, and user-friendly shell. This article describes how to install and use the fish shell in FreeBSD.
Different types of shells used in Unix
Majorly Unix shells can be categorized into two type –
- Bourne Shell (sh) – It has $ character as default prompt. POSIX shell (sh), bash, Korn shell, etc are the shells that come under this category.
- C Shell (csh) – It uses % character as default prompt. Z shell, c shell, tcsh are some shells that come under this category.
The friendly interactive shell also abbreviated as fish, is a smart and user-friendly Unix shell. Its syntax derives neither from the bourne shell and nor from the c shell, So it is considered as an exotic shell. Unlike many other shells that disable many features by default to save system resources, it enables many of them to provide more features to its users. Some of its features are given below –
Features of fish shell
- It provides auto-suggestions based on previous commands executed.
- You can configure it through the web
- Provide advanced tab completion feature
- Syntax highlighting with strict error checking
- Supports for X clipboard
- It maintains searchable command history
How to install fish shell in FreeBSD
In FreeBSD, there are two ways to install software packages: pkg and ports collection. The pkg is used to install from prebuilt binaries while ports collection is used to install packages from sources. You can use either way to install the fish shell in your system.
To install using pkg use the following command in your terminal –
# pkg install fish
Using ports collection
First, change the directory to fish port –
# cd /usr/ports/shells/fish
and then use –
# make install clean
Please note that you need to be a root user or have superuser privilege for installing packages in FreeBSD.
Working with fish shell in FreeBSD
Once the installation of the fish shell gets completed. You can start using it by executing the following command in your terminal.
When you type a command in the terminal, based on previously run commands it automatically suggests the complete command in light grey color for example when I press pkg it suggests me the full command –For using the tab completion feature first write a few words and then press the tab button to see the possible commands that can be used.
The fish shell highlights invalid commands by turning it into the red color while valid commands are displayed in a different color. Similarly, a valid path gets underlined while invalid paths turn its color into red. You can see the syntax highlighting in the following image-
How to set fish as your default shell
When you access the fish shell using fish command it gives you temporary access to the shell. If you reopen your terminal you will be back to the default shell again.
To make fish the default shell first you need to locate it –
# whereis fish
Then execute the following command –
# chsh -s /usr/bin/fish
To set tcsh as your default shell again, use-
# chsh -s /bin/tcsh
Ok, that’s all for now. If you have something to say on this topic then write us in the comments below.
You might also like
This post was last updated on August 1st, 2020 at 12:11 pmFreeBSD provides various tools as a part of its base system. In FreeBSD, there are two ways to install
This post was last updated on May 26th, 2020 at 09:37 pmLinux PXE Server This whitepaper will describe how to set up a pxe server. Hardware Required: HP ProLiant Server,