For developers, choosing the right tool could mean the difference between seconds or days of work (the scale naturally varies from job to job). A skilled creator would want to differentiate between picking the right hammer, tool bench, computer, or programming language for the right job and include all the ones that prove necessary for the task at hand. For this reason, a developer should want to pick the right shell to accommodate their style of development. This would allow the coder to better manage their software development environment, aiding in a more productive and efficient process.
A shell is an application that assists a user in operating their computer to launch other applications from within the command line, which is an interpreter. There are many shells a programmer could take advantage of. The main ones usually seen are bash and zsh. FSH, the Friendly Interactive Shell, is a Unix-based shell that was created with interactivity and usability as the primary concept of its design.
What is FSH?
FSH, or Fish as it is affectionately known, is a fully interactive and robust shell aimed to be more feature rich than the two mainstream shell applications, bash or zsh. Chief among these features is its extensive UI design which includes autosuggestions, syntax highlighting, tab completion, and selection lists that can be filtered and navigated.
On top of the helpful aesthetic characteristics, there is an entire suite of unique commands packaged with Fish shell. Most of these deal with customizing and tailoring the FSH experience for a developer’s unique work style; for example, the commands related to history (more on this later). In addition, a user is able to run operators directly in the shell, utilizing AND or OR instead of the symbolic versions of && or || found in other shells.
More than the pretty colors and the expansive command packages, FSH deals away with clunky architecture; the authors of FSH even advertise on their main page: “you’ll never write esac again” (the command in this friendly shell is simply case).
Normally, shells and utility interfaces, along with system and user-level APIs (Application Programming Interfaces) would adhere to a set of standards called the POSIX (Portable Operating System Interface for Unix) specified by the IEEE (Institute of Electrical and Electronics Engineers). These standards codify what is usually needed for the compatibility of applications when they move from one Unix system to another.
FSH is intentionally not completely POSIX compliant, aiming instead to address the philosophical inconsistencies that the creators of this shell perceived in the standards. It is a totally different programming language, sort of like what Python is to C++. This means that occasionally, a simple POSIX compliant bash script will need either some adaptation or a full rewrite in order to run with FSH.
As it turns out though, a lot of shells – and even operating systems – are not completely POSIX compatible (if at all) in the first place, so this problem of portability and compatibility permeates throughout the computer science field.
Scripts written in FSH will not work outside of it. Generally speaking, this would not necessarily be a problem, it is just something for developers to keep in mind.
How to Install and Run FSH (FISH)
For a simple install, you can go directly to the project’s homepage and follow the instructions there. There are several ways you can install FSH onto your system, so make sure to follow the method you want for the Operating System you have. For example, on my Mac and Linux environments, I have used the command brew install fish in the terminal.
When FSH is first installed, it is not the default shell. To access and start using FSH, simply run the command fish and use the command exit to quit.
You can make FSH your default shell on the terminal via two simple steps:
Add the line /usr/local/bin/fish to the /etc/shells file (it may already be there depending on how you have installed the shell).
Then, change your default shell using the command chsh -s /usr/local/bin/fish
This is assuming FSH was installed in /usr/local/bin, as is the default location for when it is compiled. Otherwise, if using a package manager, it could be located in /usr/bin/fish.
To change it back to another shell, simply use the previous steps while substituting the location /usr/local/bin/fish with the location of the desired shell, such as /bin/bash.
Benefits of FSH Shell
After using FSH for a bit, it is easy to see the appeal of this unconventional shell. I have mentioned a myriad of its key features, but the one consistent characteristic of this shell that every new user will benefit from is that FSH works completely out-of-the-box, meaning there are no customizations to be made or files to edit to start using FSH – you simply install it and launch it. The other features that a user might quickly notice at the start include an aesthetic prompt (that can be customized), autocompletion, parameter suggestion, syntax highlighting, and web-based configuration. All of that combines to make it so that FHS is regarded as one of the most beginner friendly shells.
With its web-based configuration, a developer can completely change their user experience with FSH. Simply run fish_config to open the web client. From there, you can choose the themes, colors, prompts, inspect the FSH functions and variables, and see the history of commands used. Changes are, in turn, stored in the ~/.config/fish folder and can be accessed and edited there to dodge the optional web configuration.
Speaking of aesthetics, FSH comes with a unique visualization feature for the typing of commands. You will find right away that with FSH you can run the usual Unix commands: operations like cd, ls, cp, mv, and rm. Running these – or any recognizable commands – programmers will notice that the words appear in different colors. This is the syntax highlighting feature mentioned above and it makes reading and understanding command execution easy.
Adding to the usability of this shell, FSH’s autocompletion will suggest lines of commands you might want to run as you type out those commands (in case you forget the full command or want to save a few extra seconds typing the whole thing out). The shell does this based on your locally saved history of executed commands. For example, if you have tried running ls ~/.config/fish before and you are typing ls now, it will appear as a suggested command to execute.
Autocompletion suggestions also work for commands themselves. Type l and hit the tab button, and you will see a list of commands that begin with the letter l.
FSH also can suggest parameter options and their uses. Say you want to use the ls command with a flag option to list specific files in a directory but do not know which flags you need or have the option of choosing. Type ls – and hit the tab button and you will get a list of parameters that are associated with that command.
As previously stated, autocomplete is achieved through a stored file of executed commands. You can access and control this file by using the history command and its options (to view a list of recently made commands, simply execute history). Separately, what makes the autocomplete of the command flag options function is FSH’s utilization of the already existing man pages of those commands. Man pages are those files associated with command packages that display the helpful “help guide” for users, such as when one runs man ls or cd -h.
With plugins, you can expand the functionality of FSH. To quickly get started with plugins and more efficiently manage them with FSH, download Fisher. Fisher is a plugin manager designed specifically for FSH that extends its capabilities. You can download and install Fisher directly in the Fish Shell using the command curl -sL https://git.io/fisher | source && fisher install jorgebucaran/fisher. Afterwards, it is a matter of using Fisher’s commands to install, update and remove plugins; you can do this by executing the command fisher install <path/of/github-repo>.
Conclusion to FSH Shell Overview for Developers
In my opinion, I can see the Fish shell being either a novelty to some or a major asset to developers, depending upon how you develop your software. Not only is the structure of this shell geared towards flexibility and efficiency, but it is also expandable with a myriad of support from both the original authors, as well as, a community of Fish enthusiasts. A brief scan through the Github pages shows that those who love this shell truly love this shell, expanding the functionality of this friendly shell with plugins and a host of other addons. Whether you decide to dabble in using this shell occasionally or even make the switch to FSH as your default shell, you will be welcomed as a friend from the FSH community.