No, the title for this post is not a mistake. I’m not referring to the gill-bearing aquatic craniate animals that lack limbs with digits or the shark-shaped magnetic Linux emblem that you might have stuck to your car. The “fish” I’m referring to is a Linux shell and one that’s been around since 2005. Even so, it’s a shell that a lot of Linux users may not be familiar with.

The primary reason is that fish isn't generally installed by default. In fact, on some distributions, the repository that provides it is one your system probably doesn't access. If you type "which fish" and your system responds simply with another prompt, you might be missing out on an interesting alternative shell. And if your apt-get or yum command can't find what you're looking for, you will probably have to use commands like those shown below to get fish loaded onto your system.

On Ubuntu:

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

The ppa:fish-shell repository contains regular builds of the most recent source for fish, built from the Git master trunk at https://github.com/fish-shell/fish-shell/.

In case you're not familiar with the term "PPA," it stands for "Personal Package Archive" and is a software repository for source packages.

On RHEL:

$ cd /etc/yum.repos.d/ $ sudo wget https://download.opensuse.org/repositories/shells:fish:release:2/RHEL_7/shells:fish:release:2.repo $ sudo yum install fish

What's different about fish?

If you've never have heard of “fish” related to Linux, you might be interested in knowing that it’s a shell that some refer to as “exotic.” One of its claims to notoriety is that it promises to be quie a bit friendlier than the older shells, such as bash. In fact, "fish" stands for “friendly interactive shell” and it promises to make it easier, especially for new Linux users, to remember and to execute commands.

If you install fish and set up an account to use fish as its shell, you'll notice right away that the command line prompt is a little different.

nemo@stinkbug ~>

Type a letter or two and you will notice that the shell attempts to guess what you want to do, suggesting what you might be trying to type. If you press a tab key, it will begin displaying a list of commands that start with the letter(s) you've typed so far. In the display below, only the "c" in "cd" has been typed and the tab key pressed. Note how the system responds by displaying a previously entered command.

nemo@stinkbug ~> cd .local c++filt (Executable link, 26kB) c89 (Executable link, 428B) c89-gcc (Executable, 428B) c99 (Executable link, 454B) ... and 94 more rows

Press the tab again, and another screenload of possible commands will be displayed.

Once the user has typed enough of a command to uniquely identify it, another press of the tab provides command completion. The user can then just press the enter key to run it.

Another difference between fish and more conventional shells is that fish doesn't use = signs to assign values to variables. To set up a variable, you need to use the set command.

nemo@stinkbug ~> TODAY=`date` fish: Unsupported use of '='. In fish, please use 'set TODAY `date`'. nemo@stinkbug ~> set TODAY `date`

Note that fish's disdain for the = sign doesn't extend to things like configuring aliases (e.g., alias me="whoami"). That's the business of the alias command, after all, not the shell.

You will also notice that the history file for this shell is buried a few directory levels in the user's home directory. You can find it using ~/.local/share/fish/fish_history

Another difference is that return codes from commands run in fish are not stored in $? as in bash, but in $status.

nemo@stinkbug ~> echo hello hello nemo@stinkbug ~> echo $status 0

As with other shells, 0 indicates success (no errors encountered). Any other value means that something went wrong.

Another feature of fish that users might appreciate is that it allows them to select their screen colors, change their prompts, and view functions, variables, history, and key bindings on a web page using the fish_config command.

nemo@stinkbug ~> fish_config

How Fish is different from other shells

The features that differentiate fish from other shells include:

Autosuggestions — Fish suggests commands (in muted gray) as you type, based on your command history and command completions

VGA Color — Fish supports 24-bit true color

Full scriptability — Simple and clean syntax

Web Based configuration — Using fish_config command for settings

Man Page Completions — Fish generates command completion options automatically by parsing installed man pages

Syntax highlighting — Fish uses different colors for parts of commands to help users focus on different things (e.g., commands versus arguments)

Learn more about fish

You'll find that fish has a lot of features that make it worth investigating and may win over users who are a little intimidated by the Linux command line.

You can learn more about fish at fishshell.com.