Linux Guide 📓

Fish

Last updated: 2024, Mon Jun 3rd at 13:48 CDT

Fish is a friendly smart shell. This includes features like syntax highlighting, autosuggest-as-you-type, and tab completions that just work. Fish is not POSIX compliant, though, so most shell scripts wont run normally.

Official Site GitHub Documentation

To Install: #

Preferred method

Install though your package manager

sudo pacman -S fish
sudo apt install fish
sudo dnf install fish
sudo zypper in fish

Essentials #

You can set fish as your default shell but do not remove bash or sh, this can break installs or install scripts. To switch to using fish as your default shell, run fish then

chsh -s (which fish)

to add to root user

sudo chsh -s (which fish)

There are several advantages to using fish:

  1. Syntax highlighting and Autosuggestions, incorrect commands will be highlighted red along with greyed out suggested commands that you can accept with or alt+to accept the first word.
  2. Tab Completion with interactive command options, by pressing tab fish tries to guess the word. If there is more then one then they are opened in menu. When a - after a command and tab is used it will try to list all the options.
  3. Local web-based help and configuration, in the terminal if you type help or fish_config a page will open in your browser. The help command opens the official documentation and fish_config opens a page that allows you to configure some of the theming and prompts.
  4. Interactive history search, A menu can be opened by pressing Ctrl+shift+r that allows you to search though the history of commands.
  5. Abbreviations and Automatic cd, both of these can make it quicker to execute commands and navigate. Abbreviations can be used to shorthand code, so a command upg could be an abbreviation for nala upgrade, this can also be used for frequent directories. Additionally in fish, it is not necessary to use cd to change directory, ~/downloads works the same as cd ~/dowloads.

Extras #

Note

Functions and settings can be put in ~/.config/fish/

When first starting out, most of your settings can go into config.fish. However as you expand the config file, it will be easier to section out the settings for better speed and for easier reading. Start by moving functions into the .config/fish/functions/ and then move snippets to like alias or abbr to .config/fish/conf.d/. Functions need to be in a file by the same name, the function msl should be in the msl.fish file. Additionally fish will execute files in the same directory in a normal order (“01” before “2”), this means that you can create a load order by labeling 00-whatever.fish or 00_whatever.fish.